Basic JavaScript - Escape Sequences in Strings

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

Your code so far

const myStr = "FirstLine\n\t\\SecondLine\nThirdLine"; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Escape Sequences in Strings

Link to the challenge:

This is correct… you don’t describe an issue, either… Not sure what you’re posting about.

A populare issue, isn’t it :smiley:

and a summary:

Here’s what I find in the challenge:

FirstLine
    \SecondLine
ThirdLine

Let me put it differently:

FirstLine[NEWLINE]
[TAB][LITERALLY]\SecondLine[NEWLINE]
ThirdLine

[LITERALLY] of course means, that the following character is to be taken as such (literally) and not interpreted as a control character, or as they say in the trade, the character needs to be escaped.

So, what character do you use in JS to replace the “[LITERALLY]”?

Or in one single line:

FirstLine[NEWLINE][TAB][LITERALLY]\SecondLine[NEWLINE]ThirdLine

Reading Educates

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