Basic JavaScript - Escape Sequences in Strings

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

Please help cannot execute this code…

Your code so far

var myStr = "FirstLine
\\SecondLine\\\rThirdLine"
var myStr = "FirstLine
\\SecondLine\\\rThirdLine";

Your browser information:

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

Challenge: Basic JavaScript - Escape Sequences in Strings

Link to the challenge:

Please don’t post a picture of your code. Pictures of code are hard to read.

Can you be more specific about what’s happening and where you are stuck?

You cannot break a string across multiple lines like this.

You should not be using the var keyword.

not sure why it was across multiple lines as shown above. Posted photo for more context… When you click on the picture does it not enlarge??

var myStr = "FirstLine\n\\\SecondLine\\\rThirdLine";

The photo is not helpful.


You are still using var. You should not be using var.

  1. You have not indented the text SecondLine with a tab escape character.

  2. Also, you have an escaped slash at the end of the text SecondLine but that is not part of the instructions.

  3. Also, you are using a carriage return instead of a new line after the text SecondLine.

thank you i got it

const myStr = “FirstLine\n\t\SecondLine\n\ThirdLine”;

1 Like

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