Friday, December 23, 2016

Template literals

I have to follow up with changes to ES6. Today I noticed template literals (there is also tagged template literals but that I will check later).
I am really happy with that, it is simple and helps a lot.

Template literals are a new feature in ES6 that provide us string template things!

Let's have a look on real example

var a = "Apples";
var b = 10;
console.log(`I would like to buy ${b+b} ${a}.`);
// I would like to buy 20 Apples.

2 comments :

NotesSensei said...

Looks suspiciously like JSF's EL :-)
As we all know: ultimately everything gets rewritten in JavaScript

Dmytro Pastovenskyi said...

yes, i have same feeling, everything is moving to JS :)