February 2018
Intermediate to advanced
298 pages
8h 22m
English
Template strings are just a new literal for creating strings, which makes various things easier. They provide features such as embedded expressions, multiline strings, string interpolation, string formatting, string tagging, and so on. They are always processed and converted to a normal JavaScript string on runtime; therefore, they can be used wherever we use normal strings.
Template strings are written using backticks instead of single or double quotes. Here is an example of a simple template string:
let str1 = `hello!!!`; //template stringlet str2 = "hello!!!";console.log(str1 === str2); //output "true"
Read now
Unlock full access