The problem is with the interval in setTimeout
. The orange color might be getting set, but then immediately it would be changed because of the new call to changeColor
– where in the first iteration, the interval for setTimeout is 1000*j = 0
.
Instead you could make it 1000*(j+1)
:
setTimeout(function() {
...
}, 1000* (j+1));
1
solved Why can’t orange be shown? [closed]