Trouble with quotation marks in strings

I’m not really sure why this isn’t working.

Your code so far


var myStr = "I am a \"double quoted"\ string inside \"double quotes"\.; 
console.log(myStr)

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 9; SM-S102DL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36.

Challenge: Escaping Literal Quotes in Strings

Link to the challenge:

I suspect that the virtual keyboard on your phone is injecting invisible characters.

1 Like

also you escape characters by putting the backslash before them not after

I’ve tried it both ways to see if that was the problem . Changing it doesn’t change the error.

Can you repost your latest code attempt (not a screenshot)?

To enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

In escaping quotes in strings the backlash to escape the first quote mark comes first just as in your code and the second backlash comes right before the closing quote mark.

Hope this helps.