HELP on Escape-Sequences-in-Strings

Tell us what’s happening:
Hi! I am doing the Basic Javascript course and I am enjoying it so much! Until I got stuck there in the “escape-sequences-in-strings” episode.
I would like to know what is wrong that I can’t advance.
Thank you in advance for your time!!

Your code so far


var myStr = "\t \n FirstLine \n \b \\ SecondLine \n ThirdLine"; // Change this line


Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings

So the instructions say you should be generating the following line:

FirstLine<newline><tab><backslash>SecondLine<newline>ThirdLine

(I’m showing it a little different, but you get the idea). Note that <newline>, <tab> and <backslash> are NOT what you need to show, they’re looking for the escape sequence, but just a different way of representing them. There are NO spaces. And you have characters before FirstLine – is that accurate?

1 Like

Im so sorry, i don’t know why i still don’t get it, even though you sound kind and helpful.
I am a total newbie in that so;

  • if /n /t // are not what i need to show, should i place / before them so it doesn’t show it?
  • is / the escape sequence??
  • about " there are no spaces" should i delete the spaces of add spaces?
  • everything i got before FirstLine is that — var myStr = "FirstLine

Thank you for replying and please have patience with me, I am totally new at that…

Have a nice day!!!

It should look like this:

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

Not working for me. I have:

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

Is my font wrong?? I’m on an iPad in Safari doing this, is that the problem??

I’ve tried retyping it, double checking for no spaces, searching google, and double checking for my semicolon at the end. I can’t get the test to pass. Anything else I should try?

Thank you brethren and sisteren

You need to use single ' or double " quotes for the string.

1 Like

Thank you for your reply. In the code I provided I have double quotes around the line of code. Did I place them incorrectly?

Found my problem. I have a thing in my settings called “smart punctuation” which was adding a font markup property to the text I was entering in the code editor. Made it not recognize my otherwise correct code. I disabled Smart Punctuation and retyped and then resubmitted the test and it ran fine.

That’s what I get for coding on an iOS device.

1 Like