ES6 - Template Strings


// ES6 - Template string:

Template string is a feature that encompass multi-line strings, and string 

Using backticks, we can have strings that span multiple lines, and we do not 
have to escape quotes.

To demonstrate string interpolation, consider this code:

var name = 'jack';
var age = 22;
var output = `${name} is ${age} years old`;

In the above code, we use the dollar sign and curly braces to insert the values 
of variables into the string.  We can have more than just variables inside the 
curly braces.  We can put expression between those curly braces.  We can also 
call a function and whatever that returns will be outputted.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License