More JavaScript elements

Let's take a look at some more JS elements.

Template literals

Template literals are enclosed by backtick characters (") instead of double or single quotes. They allow a concise syntax for string values that result from a combination of fixed text parts and variables, including some multi-line string values.

Press + to interact
const classValues = "card important";
const name = "Joker";
const htmlTemplate = `<div class="${classValues}">
<p>Hello ${name}!</p>
</div>`
console.log(htmlTemplate)

The spread operator

...