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 = [].slice.call(document.querySelectorAll(selector), 0);
// Now use the element array to fetch a list of ids:
var ids = elArray.map(function(el) { return el.getAttribute('id'); });