ES6 Template Syntax


Template Strings use back-ticks (“) rather than the single or double quotes we’re used to with regular strings. A template string could thus be written as follows:
var guitar = `Jackson SLAT3-7`;

String Substitution

One of their first real benefits is string substitution. Substitution allows us to take any valid JavaScript expression (including say, the addition of variables) and inside a Template Literal, the result will be output as part of the same string.

Template Strings can contain placeholders for string substitution using the ${ } syntax, as demonstrated below:

// Simple string substitution
var guitar = "Jackson Soloist";
console.log(`My guitar is, ${guitar}!`);
// => "My guitar is, Jackson Soloist!"