Semanticize intermediate headings
This commit is contained in:
@ -11,7 +11,7 @@ JavaScript ES6 introduced, among many other things, the [spread operator (`...`)
|
||||
|
||||
We can use the spread operator to convert iterables or, as they are sometimes referred to, array-likes. Let's take a look at some examples:
|
||||
|
||||
**String**
|
||||
### String
|
||||
|
||||
When the spread operator is applied to a string, the result is an array of strings each one representing a character of the original string:
|
||||
|
||||
@ -20,7 +20,7 @@ const name = 'Zelda';
|
||||
const letters = [...name]; // 'Z', 'e', 'l', 'd', 'a'
|
||||
```
|
||||
|
||||
**Set**
|
||||
### Set
|
||||
|
||||
A [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) is a collection of unique values. When the spread operator is applied to it, the result is an array of the stored values:
|
||||
|
||||
@ -32,7 +32,7 @@ const uniqueValues = [...values]; // [1, 2, 3, 4]
|
||||
|
||||
Note that the above example is the basis for the [uniqueElements snippet](/js/s/unique-elements).
|
||||
|
||||
**NodeList**
|
||||
### NodeList
|
||||
|
||||
A [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) is a collection of nodes, returned by methods such as `document.childNodes()` or `document.querySelectorAll()`. While it implements some methods that help manipulate it as an array (e.g. `NodeList.prototype.forEach()`), it's oftentimes desirable to convert it to an array. When the spread operator is applied to it, the result is an array of the contained nodes:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user