Using more declarative way to create array in nodeListToArray
This commit is contained in:
@ -5,7 +5,7 @@ Converts a `NodeList` to an array.
|
|||||||
Use `Array.prototype.slice()` and `Function.prototype.call()` to convert a `NodeList` to an array.
|
Use `Array.prototype.slice()` and `Function.prototype.call()` to convert a `NodeList` to an array.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const nodeListToArray = nodeList => Array.prototype.slice.call(nodeList);
|
const nodeListToArray = nodeList => [...nodeList];
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
const nodeListToArray = nodeList => Array.prototype.slice.call(nodeList);
|
const nodeListToArray = nodeList => [...nodeList];
|
||||||
module.exports = nodeListToArray;
|
module.exports = nodeListToArray;
|
||||||
|
|||||||
Reference in New Issue
Block a user