sainture
4/3/2016 - 6:51 AM

ECMA 6 - Template Strings

ECMA 6 - Template Strings

// old way
var name = 'Sam';
var age = 42;
console.log('hello my name is ' + name + ' I am ' + age + ' years old');

// new way using template strings
var name = 'Sam';
var age = 42;
console.log(`hello my name is ${name}, and I am ${age} years old`);

// you can even pass variables and write multiline text inside ``