Problem with the Simon's game, showing multiple boxes

Problem with the Simon's game, showing multiple boxes
0

#1

Hi, I’m trying to show the user the current state of the game.
But for some reason, all the elements are getting classed at a time without any delay. I’m confused.


#2

Take the delay += 500 out of the setTimeout callback.

Currently the forEach is run and loops through all the items. But the delay is only incremented after the initial delay (100 ms) when the forEach already finished looping through all the items (and already “scheduled” the callback functions with the initial delay).