Why this piece of code does not run outside of a handler function?
[...document.querySelectorAll('.movement__row')].forEach((row, i) => {
console.log(i);
if (i % 2 === 0) row.style.backgroundColor = 'orangered';
});
Why this piece of code does not run outside of a handler function?
[...document.querySelectorAll('.movement__row')].forEach((row, i) => {
console.log(i);
if (i % 2 === 0) row.style.backgroundColor = 'orangered';
});