Why doesn't this work? escaping literal quotes

Tell us what’s happening:

Your code so far

myStr = “I am a “double quoted” string inside “double quotes”.”;


**Your browser information:**

User Agent is: <code>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36</code>.

**Link to the challenge:**
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings

Make sure to format your code.

Looks like you need to use backslashes to escape double quotes. For ex.

var sampleStr = "Alan said, \"Peter is learning JavaScript\"."; will output

Alan said, "Peter is learning JavaScript".

1 Like