Escape Sequences in Strings/ use of \r

Tell us what’s happening:

guys, I passed this challenge without adding \r which I saw in all of your responses. and other thing that I didn’t get it is use of carriage return \r
Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5.

Challenge: Escape Sequences in Strings

Link to the challenge:

Since you are using the newline character, \n, a carriage return \r isn’t needed. The solution doesn’t use a \r and the problem doesn’t ask for one, so I don’t understand what you mean by

actually I didn’t get what does \r do ?

What happens if you try

console.log("Part 1\rPart2");

it’s acting like new line character \ it right?

It is similar, yeah. There are some differences in their history and use (too much to summarize, but there are some cool articles on Google), but the two are very similar.

1 Like

oook. thank u so much :slight_smile:

1 Like