Escape Sequences in Strings - Nothing Works

Escape Sequences in Strings - Nothing Works
0.0 0

#1

Tell us what’s happening:
I’ve tried string after string after string and nothing works. I tried everything I can think of, then every possible alteration.

Your code so far

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

With this one, 3 are checked except for
myStr should have encoded text with the proper escape sequences and no spacing.

I’ve also tried:

var myStr = "FirstLine\\nSecondLine\\rThirdLine"; // Change this line
var myStr = "FirstLine\nSecondLine\\rThirdLine"; // Change this line
var myStr = "FirstLine\n\SecondLine\\rThirdLine"; // Change this line
var myStr = "FirstLine\n\\SecondLine\\rThirdLine"; // Change this line
var myStr = "FirstLine\n\\SecondLine\\r\ThirdLine"; // Change this line
var myStr = "FirstLine\n\SecondLine\rThirdLine"; //Change this line
var myStr = "FirstLine\n\\SecondLine\\r\\ThirdLine"; // Change this line
var myStr = "FirstLine\n\SecondLine\\rThirdLine"; // Change this line

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36.

Link to the challenge:


#2

Your error is between SecondLine and ThirdLine. You need a \ on the same line as SecondLine (it must be escaped).


#3

I see what you mean after getting the answer from here. I thought I had already tried this though. Thanks for the help.

What doesn’t make any sense is that I had to go to a different website to get the correct answer and analyze it from there. Every single answer I found on this site was wrong.