I have a
You can also do this: And after this you can call forEach on your collection: The best and most secure way would be actually to only add forEach in cases when it doesn't already exist:
NodeList.prototype.forEach = HTMLCollection.prototype.forEach = Array.prototype.forEach;
document.getElementById("niceParent").children.forEach(...)
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}
if (window.HTMLCollection && !HTMLCollection.prototype.forEach) {
HTMLCollection.prototype.forEach = Array.prototype.forEach;
}