ES6 Template Strings

node v4.9.1
version: 1.0.0
In ES6 you can use template strings to more easily construct strings:
var person = { name: "Tom", age: 20 }; // Before: var string = + " is " + + " years old"; // Now: var string = `${} is ${person.age} years old`;
Template strings also allow you to write multi-line strings:
var string = `This is<br/> a multi-line string<br/> without having to use<br/> any tricks. Pretty userful<br/> for HTML`
For much more advanced template strings, check out:

no comments

    sign in to comment