Basic JavaScript - Escape Sequences in Strings

Tell us what’s happening:
From everything I can tell, I have input the code correctly. However, it gives me this error:
// running tests myStr should contain the strings FirstLine, SecondLine and ThirdLine (remember case sensitivity) There should be a newline character between SecondLine and ThirdLine myStr should only contain characters shown in the instructions // tests completed
Also, when I use console.log(myStr); , it adds an extra tab character in front of the second line, even though there is clearly only one tab escape character. Please advise.

Your code so far

const myStr = "FirstLine\n\t\\SecondLine\nThirdline"; // Change this line

Your browser information:

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

Challenge: Basic JavaScript - Escape Sequences in Strings

Link to the challenge:

below your code add this
console.log(myStr);

this will log the string so you can see if it displays the way it should or not

I’d look at the capitalization on “ThirdLine”.

Wow… epic beginner fail… I got so obsessed with console.log(myStr) making it look like there was an extra tab that I completely missed that. Thanks.

Happens to all of us. A programmer’s best tool is a second pair of eyes.

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