Escape Sequence Javascript

Escape Sequence Javascript
0

#1

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";

#2

Does one of these help?:





#3

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.


#4

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


#5

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.


#6

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


#7

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


#8

your code is…given below…

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