--- title: Template Literals --- ## Template Literals ## Introduction: When we want to use a variable to make a string, it becomes very painful as we have to use a + sign to concatenate and keep track of quotes. Now with ES6, we can make the string using backticks. Then, insert the variable like this, ${variable}. ```javascript const name='John'; const city='London'; Older Style: const sentence ='My name is '+ name +'. I live in '+ city. ES6 way: const sentence = `My name is ${name}. I live in ${city}`; Here ${name} and ${city} are going to be interpolated by the variable name and city respectively. ``` ## MultiLine Strings: Older style: When we wanted to span our string into multiple lines, we had to use backslashes. ```javascript const multipleLineString= "We have \ multiple lines \ here"; ``` Now when we want to create a mutiline string, we can make use of template strings. We can surround our string with backticks. This approach is extremely helpful when we want to create some dynamic html markup. ```javascript const htmlMarkup = `