ES6 - Template Strings
// ES6 - Template string:
Template string is a feature that encompass multi-line strings, and string
interpolation.
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.
page revision: 0, last edited: 19 Feb 2017 06:43





