May 2019
Intermediate to advanced
316 pages
7h 13m
English
Template literals can be used to concatenate strings. The traditional way to concatenate strings is to use the + operator, as follows:
var person = {firstName: 'John', lastName: 'Johnson'};var greeting = "Hello " + ${person.firstName} + " " + ${person.lastName};
With the template literals, the syntax is the following. You have to use backticks (` `) instead of single or double quotes:
var person = {firstName: 'John', lastName: 'Johnson'};var greeting = `Hello ${person.firstName} ${person.lastName}`;
Next, we will learn how to create classes using JavaScript ES6 syntax.
Read now
Unlock full access