Escape Sequence in String Exercise Confusion

Escape Sequence in String Exercise Confusion
0

#1

This exercise baffled me. it want me to create an escape sequence in string so I did \myVar\n\r, myVar\r, and myVar\n. I still have syntax errors. Can you help m e out. Thank you


#3

Hi. Your Thirdline is misspelled! It should be ThirdLine (note uppercase L).


#4

Well see the issue with testing is that it’s case sensitive.

They want ThirdLine

Your wrote Thirdline.

(tests can be written to be case insensitive in general, but they don’t seem to be)

This test works fine - I passed it on Sunday


#5

Ahhhh I hate stupid things like that


#6

I wouldn’t consider it stupid per se, Javascript is a case sensitive language - it’s good practice to focus on the case sensitivity when learning Javascript for that reason


#7

I didn’t mean javascript was stupid. I meant I hate it when I do stupid things like that. :rage:


#8

Assign the following three lines of text into the single variable myStr using escape sequences.
var myStr = FirstLine\n\SecondLine\r\ThirdLine\; ?


#9

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

You need to escape the backslashes to, so not \n\SecondLine. Instead \n\\Second Line


#10

Syntax Error said Unexpected ‘’ and missing semicolon. I looked at this code below and I don’t understand why it’s not working.

var myStr = FirstLine\n\Second Line\r\ThirdLine;


#11

I did typed var myStr = FirstLine newline backslash SecondLine carriage return backslash ThirdLine. I tried to post this code but it doesn’t reflect what I’m trying to do.


#12

You have a \ following by nothing

\n
\r\

The first backslash only says ‘comment out the next character’ - to comment out a backslash you need to use \\


#13

I got it! Thank you for helping out!