Escaping Literal Quotes in Strings

In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (\) in front of the quote.

Use backslashes to assign a string to the myStr variable so that if you were to print it to the console, you would see:

const myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line
0 0 votes
Article Rating
Was this article helpful?
YesNo
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
Scroll to Top