Question 3
Back to Exercise
What does the following JavaScript code print (console output, as in Node.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!