Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 623 Bytes

string-interpolation-with-template-literals.md

File metadata and controls

17 lines (14 loc) · 623 Bytes

String Interpolation With Template Literals

ES6 adds support for template literals. Template literals make it much easier to compose strings of content -- string interpolation. They allow for single and double quotes without having to fuss with escaping. Embedded expressions are also supported which means you can avoid awkward-to-type string concatenation with the + operator.

Here is an example:

> let movie = 'it'
undefined
> `What's up, I just saw "${movie.toUpperCase()}".`
"What's up, I just saw "IT"."