Helper function to create an array from DOM nodes. Useful for array methods.
function getDomNodeArray(selector) {
// get the elements as a DOM collection
var elemCollection = document.querySelectorAll(selector);
// coerce the DOM collection into an array
var elemArray = Array.prototype.slice.apply(elemCollection);
return elemArray;
};
var divs = getDomNodeArray('div');