Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

ES6 Template Strings

node v0.12.18
version: 1.0.0
endpointsharetweet
In ES6 you can use template strings to more easily construct strings:
var person = { name: "Tom", age: 20 }; // Before: var string = person.name + " is " + person.name + " years old"; // Now: var string = `${person.name} 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: https://hacks.mozilla.org/2015/05/es6-in-depth-template-strings-2/
Loading…

3 comments

  • posted 7 years ago by bigjeff
    var
  • posted 3 years ago by nobviksa333
    Var
  • posted 7 months ago by qasimaloudat
    مش فاهم شيء

sign in to comment