Basic JavaScript - Escape Sequences in Strings

Tell us what’s happening:
Describe your issue in detail here.

the test is
myStr should not contain any spaces

myStr should contain the strings FirstLine, SecondLine and ThirdLine (remember case sensitivity)

FirstLine should be followed by the newline character \n

myStr should contain a tab character \t which follows a newline character

SecondLine should be preceded by the backslash character \

There should be a newline character between SecondLine and ThirdLine

myStr should only contain characters shown in the instructions

and my answer is

const myStr = "\t\nFirstLine\n\\SecondLine\nThirdLine";
// Change this line

can you tell me what is wrong here.

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 11) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Mobile Safari/537.36

Challenge: Basic JavaScript - Escape Sequences in Strings

Link to the challenge:

this means that the tab character is after the newline character

note that your string should start with “FirstLine”, so you shouldn’t have anything before it

Your result should be

FirstLine
    \SecondLine
ThirdLine

Right now your result is

	
FirstLine
\SecondLine
ThirdLine


the right one is what it should be, the left one is your output, and the differences are hoghlighted

1 Like

thank you.
i did it
const myStr = “FirstLine\n\t\SecondLine\nThirdLine”; // Change this line

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