Converting a NodeList to an Array in Javascript

Ever wish you could use Array functions on a NodeList returned by element.querySelectorAll or element.childNodes? It's surprisingly easy!

A NodeList is an Array-Like object that contains a .length field, but lacks useful functions like .forEach and .map that make working with Arrays so easy.

var elArray = [], 0);

// Now use the element array to fetch a list of ids:
var ids = { return el.getAttribute('id'); });