LearnFrenzy
Sign in Take a free test

JavaScript Basics · Predict the Output · Question 9

Escaped quotes Answer, explanation & discussion

  • Output
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 9 Back to Exercise

What does the following JavaScript code print (console output, as in Node.js)?

main.js
console.log('It\'s', "a \"quote\"", `and ${'more'}`);
  • A It\'s a \"quote\" and more
  • B It's a quote and more
  • C It's a "quote" and more Correct
  • D It's a "quote" and ${'more'}
Correct Answer: Option C

A backslash escapes the quote inside a string of the same kind; the backslash itself is not printed. The template literal evaluates ${'more'}.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links