Build a String Formatter - Step 15

Tell us what’s happening:

In ‘Step 15’ of “Build a String Formatter” I am not sure why the below code is getting accepted even when the output is displayed correctly.

var newWord = lowercaseWord.slice(0, 5).concat(lowercaseWord[5].toUpperCase());
console.log(newWord);

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 = lowercaseWord.slice(0, 5)

// User Editable Region

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

var newWord = lowercaseWord.slice(0, 5).concat(lowercaseWord[5].toUpperCase());
console.log(newWord);

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a String Formatter - Step 15

Welcome to the forum @arvivijay !

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] .

You are asked to use the + operator to concatenate.

And the new code should be concatenated to this existing camelCasedVersion assignment. You should not create a new variable for this.

Happy coding!

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