Template Literals
This lesson covers new ways of interpolating strings and more, with template literals.
Template literals were called template strings prior to ES6… Let’s have a look at what’s changed in the way we interpolate strings in ES6.
Interpolating strings #
We used to write the following in ES5 in order to interpolate strings:
In ES6, we can use backticks to make our lives easier. We also need to wrap our variable names in ${}
In ES6 we can use backticks to reduce our typing:
...