for (const input of document.querySelectorAll('#some-form input') { input.classList.add('error'); }
In fact, this has an even earlier baseline browser compatibility than
NodeList.prototype.forEach