Escape Sequence Javascript

Escape Sequence Javascript


Tried many ways, and looked for many examples. For the returns, how should they be written? I couldn’t find examples to save my life, and when tried on my own the closest I came was 3 out of 4…

var myStr= "FirstLine\n\\SecondLine\\r\ThirdLine";


Does one of these help?:


Common escaped characters :
’ single quote
" double quote
\ backslash
\n new line
\r carriage return
\t tab
\b backspace
\f form feed

I don’t understand what is wrong with my carriage return, or my double backslash. I tried all 3 resources, and then took to Google before posting.


Maybe you swapped the order of the r and the last \?


You should start billing me, Kev! I’m still getting one error, though…

myStr should have encoded text with the proper escape sequences and no spacing.


Close! Now you have swapped the order of \r and \\


lol, when my brother asks for help and stuff I often say “At this point I should start billing you.”


your code is…given below…

var myStr= “FirstLine\n\tSecondLine\n\ThirdLine”; // Change this line