Loading workspace environment...
Understand how programs receive data from the outside world and return results.
// Simulating incoming input data (e.g. from an API or user input)
const rawUserInput = " alice@example.com ";
// Process: Clean and normalize data
const cleanedEmail = rawUserInput.trim().toLowerCase();
// Output: Display the formatted result
console.log("Raw Input: [" + rawUserInput + "]");
console.log("Cleaned Output: [" + cleanedEmail + "]");Raw Input: [ alice@example.com ]
Cleaned Output: [alice@example.com]rawUserInput.trim()Removes leading and trailing whitespace..toLowerCase()Converts all letters to lowercase.// Assuming user input will always be in the expected format without validating// Always sanitize and validate user input before using it in calculationsArchitectural Explanation: Users may enter strings where numbers are expected, or leave fields blank.
Given a simulated user search query " JAVASCRIPT BASICS ", trim the spaces and convert to lowercase for a clean search string.