Template Literals

String Operators and Template Literals

+ concatenates once either operand is a string. < and > compare code units, so 'B' < 'a' and '10' < '9'; sort human text with localeCompare() (Collator). Template literals interpolate any expression and keep line breaks.

Concatenation, comparison and a multi-line template literalJavaScriptLive
const user = { name: 'Ada', items: 3 };
console.log('a' + 1 + 2, 1 + 2 + 'a', 'B' < 'a', '10' < '9');
console.log(`Hi ${user.name}, you have ${user.items} item${user.items === 1 ? '' : 's'}.
Total: ${(user.items * 4.5).toFixed(2)}`);