It's even better with modern JS:
document.querySelectorAll(selector).forEach(function (elem) { value = somevalue; });
Which is more obvious in intent and more flexible.Except this doesn't work, because that's not a real array, it's a stupid NodeList. :(
So you'd have to do:
Array.prototype.slice.call(document.querySelectorAll('thing'), 0).forEach(function (elem) { value = somevalue; });
ugh.