319 B
319 B
nodeListToArray
Converts a NodeList to an array.
Use Array.prototype.slice() and Function.prototype.call() to convert a NodeList to an array.
const nodeListToArray = nodeList => Array.prototype.slice.call(nodeList);
nodeListToArray(document.childNodes); // [ <!DOCTYPE html>, html ]