1.

Discuss the template literals in ES6.

Answer»

Template literals are a brand-new feature in ES6. It makes producing multiline strings and performing string interpolation simple.

Template literals, also known as string literals, allow for embedded expressions.

Template literals were REFERRED to as template strings prior to ES6. The backtick (``) character is used to enclose template literals. The dollar SIGN and curly BRACKETS (${expression}) are used to denote placeholders in template literals. If we need to use an expression within the BACKTICKS, we can put it in the (${expression}) variable.

let s1 = "Good"; let s2 = "Day"; let s = `${s1} ${s2}`; console.log(s);

Output:

 Good Day


Discussion

No Comment Found