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 now with the O’Reilly learning platform.

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