Escape Sequences in Strings in Javascript

Escape Sequences in Strings in Javascript
0

#1

here’s my code:

var myStr = 'FirstLine\n\\SecondLine\\\rThirdLine';

here’s the exercise:

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings

i don’t know what i’m doing wrong… or right.


#2

Take a closer look at the instructions.

FirstLinenewlinetabbackslashSecondLinenewlineThirdLine

you have the first new line correct. You need to give a new tab after that and a backslash.

After “SecondLine”, you just need new line before “ThirdLine”


#3

lol. u da mannnnnnnn


#4

To explain by example:

Code:

'string\nstring'

Result:

string
string

Code:

'string\tstring'

Result:

string    string

Code:

'string\\string'

Result:

string\string

Code:

'string\n\t\\string'

Result:

string
string    \

I think you should be able to understand the rest by that :slight_smile:


#5

yeh i already got it. i was reading the instructions wrong