Build a String Formatter - Step 15

Tell us what’s happening:

whats the problem in this code i didnt understand this error so please rectify it

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

let lowercaseWord = "camelcase";

// User Editable Region

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

// User Editable Region

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

lowercaseWord=lowercaseWord.slice(0, 5)+lowercaseWord[5].toUpperCase();
console.log(lowercaseWord);

Your browser information:

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

Challenge Information:

Build a String Formatter - Step 15

Can you say what is the objective of this step? What are you trying to accomplish here?

The second word in the lowercaseWord variable is "case". To access the c in that word, you can use lowercaseWord[5].

Use the + operator to concatenate lowercaseWord.slice(0, 5) with the result of using the correct method for converting strings to uppercase on lowercaseWord[5].

Now you should see camelC in the console.

Please use your own words to talk about what you need to do in this step.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

What have you tried so far?

“to concatenate” - You can understand it as “to merge together” or “add them together” if it helps you better understand the task.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.