How to insert variables in JavaScript strings?

Introduced in ES6 as “template strings”

MDN docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

const name = "Nick"
const greeting = `Hello ${name}`  // "Hello Nick"

Leave a Comment