Escape Sequences in Stringsz

Tell us what’s happening:

I am not sure what I am doing wrong, but when I click run tests nothing is changing. So I don’t know if I am doing this right or not.

Your code so far


var myStr = “
FirstLine\\SecondLine\\t
ThirdLine”; // Change this line

Your browser information:

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

Challenge: Escape Sequences in Strings

Link to the challenge:

Hey @asarathy!

The reason why you are unable to run the tests is because of syntax errors. My suggestion would be to reset the lesson.

Your task is to use the special characters for escape sequences and produce this final result.

FirstLine
    \SecondLine
ThirdLine

Use this hint that FCC gave you.
“FirstLine newline tab backslash SecondLine newline ThirdLine”

Replace the words newline, tab and backslash with their respective special characters.

Hope that helps!

1 Like

It looks like you might also be using “fancy quotes” instead of quotation marks. Are you on an Apple mobile device? If so, you will need to turn of “smart punctuation” or it will keep changing what you type to make it prettier.

Hey! Thanks for replying! I did and it’s still saying syntax errors.

Here is the code I did. It worked for a bit and then stopped working - ie the algorithim changed and then when I changed something it stopped working.

var myStr FirstLine\n\t\\SecondLine\n\ThirdLine;

your code is missing the assignment operator to store a value in the variable, and the quotes to make your piece of text a string

1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).