3 ms·
Hold your horses now, you can absolutely do: document.querySelectorAll('.element').forEach(i => { yourFunction(i); }); I've not used map a whole lot, but I'm
by 1GZ0 2y ago
Hold your horses now, you can absolutely do:
document.querySelectorAll('.element').forEach(i => {
yourFunction(i);
});
I've not used map a whole lot, but I'm positive that it would work as well.
- lioeters 2y agoOh you're right, there is a forEach method. https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach https://developer.mozilla.org/en-US/docs/Web/API/NodeList/fo... entries() forEach() item() keys() values() And maybe values().map() will work too.