Build a String Formatter - Step 14

Tell us what’s happening:

I’m so stuck. I can’t create a new Variable and assign the lowercaseWord.slice to it, and you can’t change the string value in a const. What am I not getting?

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);

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

const trimmedEnd = userInput.trimEnd();
console.log("After using the trimEnd() method, trailing spaces removed:");
console.log(trimmedEnd);

const upperCaseInput = cleanedInput.toUpperCase();
console.log("Result of using the toUpperCase() method:");
console.log(upperCaseInput);

const lowerCaseInput = cleanedInput.toLowerCase();
console.log("Result of using the toLowerCase() method:");
console.log(lowerCaseInput);

const lowercaseWord = "camelcase";

// User Editable Region

const camelCasedVersion = ""

// User Editable Region

console.log("Camel cased version:");
console.log(camelCasedVersion);

let camelCasedVersion;
camelCasedVersion = "lowercaseWord.slice(0, 5)";
console.log(camelCasedVersion);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0

Challenge Information:

Build a String Formatter - Step 14

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-string-formatter/68e4276483b0c71658aab1d3.md at main · freeCodeCamp/freeCodeCamp · GitHub

you have this, it’s declared with const, you can’t assign a new value to it, you must change this line

Just to add to what ILM already pointed out — they’re right that you can’t reassign a const, so the fix happens on that single line in the editable region (you can remove the extra lines you added at the bottom).

But there’s one more thing worth checking. Look closely at this:

camelCasedVersion = "lowercaseWord.slice(0, 5)";

Notice the quotes around lowercaseWord.slice(0, 5). With the quotes, that’s just a plain text string — JavaScript won’t actually run the .slice(), it’ll treat the whole thing as literal text. What would happen if you removed the quotes so it runs as real code instead?

So the idea is: on that one editable line, assign the result of slicing lowercaseWord directly — no quotes, no extra variables. Think about the shape: const camelCasedVersion = lowercaseWord.slice(...).

You’ve basically got it, just a couple of small tweaks!

Oh! I get it now!! One problem… I can’t login. I’m not receiving my login emails :frowning:

try writing at support@freecodecamp.org

ok, so all we have to do is change “” to : lowercaseWord.slice(0, 5); and it works.

So, anyone reading this post, looking for answers, Put: removed by mod(Don’t forget to delete the quotation marks) You don’t need to create a new line! That’s where I got stuck :stuck_out_tongue: .

Thanks for the help guys! :smiley:

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.