3 ms·
The modern DOM API has forEach on NodeList so you can skip the Array.from. document.querySelectorAll('.my-component div').forEach(node => node.style.backgrou
by esprehn 9y ago
The modern DOM API has forEach on NodeList so you can skip the Array.from.
document.querySelectorAll('.my-component div').forEach(node => node.style.background = 'yellow');
https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach https://developer.mozilla.org/en-US/docs/Web/API/NodeList/fo...