BasicBasic JavaScript: Escape Sequences in Strings

“FirstLine newline tab backslash SecondLine newline ThirdLine”

Here is my code
var myStr; "FirstLine\n\t\SecondLine\nThirdLine

Wasn’t working. Can anyone help?

Here is my code again that didn’t work:
var myStr; “FirstLine\n\t\SecondLine\nThirdLine”

Use like this way:

var myStr = "FirstLine\nSecondLine\nThirdLine";


Add a span in your page and set it’s innerHTML with javascript:

var myStr = "FirstLine\nSecondLine\nThirdLine";
document.getElementById("ltuser").innerHTML = myStr;


Review the part of the curriculum on the assignment operator, it will be really useful to know in this an future challenges