LearnFrenzy
Sign in Take a free test

JavaScript Basics · Predict the Output · Question 3

Backticks vs quotes Answer, explanation & discussion

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

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

main.js
const a = 5, b = 10;
console.log(`Total: ${a + b}`);
console.log('Total: ${a + b}');
  • A Total: 15 Total: ${a + b} Correct
  • B Total: 15 Total: 15
  • C Total: ${a + b} Total: 15
  • D Total: 510 Total: ${a + b}
Correct Answer: Option A

Only template literals (backticks) evaluate ${ }. Inside single quotes the characters are printed as they are.

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