Template Literals
Template literals use backticks. Put any expression inside ${ } and it is inserted into the text. They can also span several lines without \n.
Example
const name = "Ada";
const items = 3;
const price = 4.5;
console.log(`Hello ${name}, you have ${items} items.`);
console.log(`Total: ${(items * price).toFixed(2)}`);
console.log(`Line one
Line two`);Exercise
Which character wraps a template literal?
const s = Hello;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.