1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-04 23:58:01 +00:00

Add String Interpolation With Template Literals as a javascript til

This commit is contained in:
jbranchaud
2017-10-22 17:51:23 -05:00
parent 6c0dd2b538
commit c4caf870f0
2 changed files with 19 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
For a steady stream of TILs from a variety of rocketeers, checkout For a steady stream of TILs from a variety of rocketeers, checkout
[til.hashrocket.com](https://til.hashrocket.com/). [til.hashrocket.com](https://til.hashrocket.com/).
_579 TILs and counting..._ _580 TILs and counting..._
--- ---
@@ -225,6 +225,7 @@ _579 TILs and counting..._
- [Render An Array Of Elements With React 16](javascript/render-an-array-of-elements-with-react-16.md) - [Render An Array Of Elements With React 16](javascript/render-an-array-of-elements-with-react-16.md)
- [Running ES6 Specs With Mocha](javascript/running-es6-specs-with-mocha.md) - [Running ES6 Specs With Mocha](javascript/running-es6-specs-with-mocha.md)
- [Splat Arguments To A Function](javascript/splat-arguments-to-a-function.md) - [Splat Arguments To A Function](javascript/splat-arguments-to-a-function.md)
- [String Interpolation With Template Literals](javascript/string-interpolation-with-template-literals.md)
- [Throttling A Function Call](javascript/throttling-a-function-call.md) - [Throttling A Function Call](javascript/throttling-a-function-call.md)
- [Timing Processes](javascript/timing-processes.md) - [Timing Processes](javascript/timing-processes.md)
- [Transforming ES6 and JSX With Babel 6](javascript/transforming-es6-and-jsx-with-babel-6.md) - [Transforming ES6 and JSX With Babel 6](javascript/transforming-es6-and-jsx-with-babel-6.md)

View File

@@ -0,0 +1,17 @@
# String Interpolation With Template Literals
ES6 adds support for [template
literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/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:
```javascript
> let movie = 'it'
undefined
> `What's up, I just saw "${movie.toUpperCase()}".`
"What's up, I just saw "IT"."
```