title | summary | tags | goal | date | |
---|---|---|---|---|---|
Javascript template literals |
interpolate expressions within strings |
|
Front-End Engineering |
2019-06-09 |
Javascript template literals are string literals that support embedded expressions, like double quoted "foo %{bar} etc" strings in Ruby. You can use multi-line strings and string interpolation features with them. They were called "template strings" in prior editions of the ES2015 specification.
syntax: string text ${expression} string text
Handily, multi-line strings and newlines are both allowed.
The downside? Syntax highlighting in editors doesn't really work so well.
Read the docs.