JavaScript · Junior · Question 52 of 75

What does a template literal give you compared to string concatenation?

const msg = `Hello, ${name}!
You have ${count} new messages.`;

Explanation

Backtick strings evaluate any expression inside ${}. They don't escape anything, so building HTML from user input with them is still an XSS risk.

Further reading

Problem with a question

JavaScript · Junior · question 52

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz