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
Hi. Your Thirdline
is misspelled! It should be ThirdLine
(note uppercase L
).
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
Ahhhh I hate stupid things like that
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
I didn’t mean javascript was stupid. I meant I hate it when I do stupid things like that.
Assign the following three lines of text into the single variable myStr using escape sequences.
var myStr = FirstLine\n\SecondLine\r\ThirdLine\; ?
var myStr = FirstLine\n\SecondLine\r\ThirdLine; ?
You need to escape the backslashes to, so not \n\SecondLine
. Instead \n\\Second Line
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;
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.
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 \\
I got it! Thank you for helping out!