321 B
321 B
title, tags
| title | tags |
|---|---|
| nodeListToArray | browser,array,beginner |
Converts a NodeList to an array.
- Use spread operator (
...) inside new array to convert aNodeListto an array.
const nodeListToArray = nodeList => [...nodeList];
nodeListToArray(document.childNodes); // [ <!DOCTYPE html>, html ]