Template literals is a syntax of writing new way of string enclosed in backtick symbol. Template literals in ES6 supports below features

  • Interpolation
  • Multi Line String \
  • tagged Templates

ES6 Template Literals Syntax

Template literals are a string with expressions, expressions are evaluated at runtime and replaced with result.

String interpolation

const add = (first,second) => {

console.log(The addition of ${first} and ${second} is ${first + second}); } module.exports = {sum}

how to create a multi line string in javascript?

const multiLineString = `

multi-line string


if you use interpolation variable syntax