Merge pull request #734 from Siarhei-Zharnasek/master

Using more declarative way to create array in nodeListToArray
This commit is contained in:
Angelos Chalaris
2018-09-07 08:37:40 +03:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@ -2,10 +2,10 @@
Converts a `NodeList` to an array.
Use `Array.prototype.slice()` and `Function.prototype.call()` to convert a `NodeList` to an array.
Use spread operator inside new array to convert a `NodeList` to an array.
```js
const nodeListToArray = nodeList => Array.prototype.slice.call(nodeList);
const nodeListToArray = nodeList => [...nodeList];
```
```js

View File

@ -1,2 +1,2 @@
const nodeListToArray = nodeList => Array.prototype.slice.call(nodeList);
const nodeListToArray = nodeList => [...nodeList];
module.exports = nodeListToArray;