Build a String Formatter - Step 7

Tell us what’s happening:

Error message corrected output matches exactly the input answer that I submitted.

Your code so far

const userInput = "   Hello World!   ";
console.log("Original input:");
console.log(userInput);

const cleanedInput = userInput.trim();
console.log("Result of trimming whitespace from both ends:");
console.log(cleanedInput);


// User Editable Region

const trimmedStart = userInput.trimStart();
console.log("After using the trimStart() method - leading spaces removed:");
console.log(trimmedStart);

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0

Challenge Information:

Build a String Formatter - Step 7

I don’t think this character exactly matches the instructions. I would copy-paste the given text.

You were correct. But here is my question, “Why is it that the only difference was the length of the dash between the words “method” and “leading” in that string?” I saw that before submitting and tried to fix it by making a double dash (“–”), but that wasn’t an accepted answer either.

There are multiple dash characters. That’s why I recommend copy-paste

Thanks for answering. I also just completed the following challenge (similar to this one) by only copying the dash and keying in the rest of the string. Very interesting this is.

1 Like