Simon Game Project. Need to help to make the series of effects go in order

Right now, I haven’t yet implemented the game stared on its own you’d have to click the start button (every time you press the start button the number of boxes that light up increases).

I have implemented addEventListener to for each box. I’ve used to track the end of the transition css effect and then call a function to remove a class. Not sure if I can make this work but it seems nice.

Initially I had a for loop, which lighted up all boxes instantaneously. I’m using setInterval now, but for some reason the order of the boxes gets messed up and I can’t understand why. I’d appreciate any help.

Edit: I was using clearInterval() incorrectly which caused my interval to not clear up every time the conditional was true. It works correctly now as far as I can tell