Lesson 7. Template literals

After reading lesson 7, you will

  • Know how to achieve string interpolation with template literals
  • Understand how to use multiline strings with template literals
  • Know how to make reusable templates with template literals
  • Understand how tagged template literals can add custom processing to template literals

In JavaScript, one of my biggest annoyances has always been the lack of support for multiline strings. Having to break each line into a separate string and glue them all together is a tedious process. With the addition of template literals, that pain is gone, along with some others. Template literals introduce multiline strings to JavaScript, as well as interpolation and tagging. Don’t worry if you’re unsure what ...

Get Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.