0

I'm just learning about ES6 and one of the new things I found was template literals/strings. I'm used to doing this when I want to put strings and variables together:

var thing = "world";
console.log("Hello" + thing + "!");

With template literals, the new suggestion is to do this:

var thing = "world";
console.log(`Hello ${world}!`);

The second approach is cleaner, but is there an actual performance improvement, or is it just easier to type? Thank you!

  • "*is there an actual performance improvement*" [is this a premature optimisation](https://xkcd.com/1691/)? – VLAZ Jun 17 '20 at 16:48
  • 4
    Does this answer your question? [Are ES6 template literals faster than string concatenation?](https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation) – igg Jun 17 '20 at 16:49
  • @igg It does! Thanks :) – Test Sock Puppet Account Jun 17 '20 at 18:57

0 Answers0