The changeColor is being called in another function. I've tried this without a loop and it works just fine. The issue is it will only display on one box. I'm trying to get it to display on every box and I'm running into deadends. I've tried if and else if, it doesn't loop. What am I missing in my code? Why is it ignoring the loop?
function changeColor() {
var flash = document.querySelector(".side1");
for (var i = 0; i < flash.length; i++) {
flash[i].style.backgroundColor = 'green'
setTimeout(function () {
flash[i].style.backgroundColor = 'yellow'
}, 3000);
setTimeout(function() {
flash[i].style.backgroundColor = 'red'
}, 10000);
}
}
setInterval(changeColor, 80000000);
setInterval(changeColor, 80000000)~ 22 hours