Friday, April 14, 2017

Template literals in ES6



Template literals are new features that helps working with strings and string templates.We wrap our text in  `backticks  `



we do not need to use escape characters like \n
variables are declared within ${var }

console.log(`Pathap
                   Kudupu`)
var str='Prathap'
console.log(`My First Name is ${str}`);

Output
C:\Development\NodeProjects\vanilanode>node backticks.js
My First Name is Prathap
Pathap
                   Kudupu

No comments:

Post a Comment