Lesson 21 / 38
Template Literals
Embed expressions and write multi-line strings easily.
Embedding expressions
Anything inside ${} is evaluated as a JS expression, including function calls.
const name = "Ada";
const score = 92.456;
console.log(`${name} scored ${score.toFixed(1)}%`);
Output:
Ada scored 92.5%
Multi-line strings
Line breaks inside backticks are kept as-is — no \n needed.
const msg = `Line one
Line two`;
console.log(msg);Backticks, not quotes
Template literals use backticks, not single or double quotes — that's what enables ${} interpolation.