the “Escape Sequences in Strings” challenge requires this output :
FirstLine
\SecondLine
ThirdLine
this is my code:
var myStr = 'FirstLine\n\\SecondLine\\\rThirdLine';
however, I got this output:
“FirstLine\n\SecondLine\\rThirdLine” , exactly as I wrote it inside the single quote.
questions:
why didn’t \n give me a newline for \SecondLine?
where did the double quote at the two ends of the output come from?
why was the extra \ after \SecondLine\ included in the output?
finally, why \r was printed? or rather, what does \r do normally in JavaScript?
Hope some answers from my fellow campers!
Thanks