Help! Escape Sequences in Strings

Help! Escape Sequences in Strings
0.0 0


Please help. I’ve done all the challenges in Basic Javascript except for the “Escape Sequences in Strings” one. It seems like it should be simple, but I just can’t get it. Here’s the instructions:

Assign the following three lines of text into the single variable myStr using escape sequences.


You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above, with no spaces between escape sequences or words.

Here is the text with the escape sequences written out.


My attempts:

var myStr = “FirstLine\nSecondLine\rThirdLine”;
var myStr = “FirstLine\n\SecondLine\rThirdLine”;
var myStr = “FirstLine\\nSecondLine\rThirdLine”;

None of these work :confused:


I figured it out -_-


you could explain how you did it for others struggling with the same/similar problem :slight_smile:


Try this one.
var myStr = “FirstLine\n\tSecondLine\nThirdLine”;