Template literals

Template literals can be used to concatenate strings. The traditional way to concatenate strings is to use the plus operator:

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}`;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.77.208