Escape-sequences-in-strings

Tell us what’s happening:

var myStr=“FirstLine\n\t\SecondLine\nThirdLine”;

Your code so far



var myStr="FirstLine\n\t\\SecondLine\nThirdLine";


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:

1 Like

after reading more times.i solved it.:astonished:

Where is the solution?

if you have troubles with this challenge, you can use the Ask for help button to create a new thread with your code, and people will give you help based on the code you have written

The full explenation

Because: var myStr; // Change this line 

is what we have
1st part a variable is var then the name of the variable which is my Str
var myStr
then just like previouse lesson we add the = and the “” to conect the content

var myStr=""

Now comes the hard part the adding
FirstLine
\SecondLine
ThirdLine
we know that the new line is important so let’s remove those

var myStr="FirstLine\SecondLineThirdLine"

and we know that`\n= newline
so lets add those

var myStr="FirstLine\nSecondLine\nThirdLine"

then we need to add a form feed
\f = form feed
and close it with a ;

var myStr = "FirstLine\n\t\\SecondLine\nThirdLine";

“1Form feed means advance downward to the next “page”. It was commonly used as page separators, but now is also used as section separators.” In this case we used it as a section seperator

1stack overflow