This is the code: https://codepen.io/lbluigi/pen/BZWLBg?editors=0010
Please note that it is not finished yet, I have to write other functions to reset the game and to play on strict mode. But I won't until I can solve this bug. Let me explain what happens.
When the page repeat the series of colors and, once it has finished, it add another new color to the series, sometimes the page skips a color. The page doesn't hover the color and doesn't play the sound.
For example, I have a series of colors =
[red, blue, green, blue, yellow, green] and the page shows
[red, blue, green, blue, green] skipping yellow. This is an example. Often it happens when the series have two same colors in sequence, like
[blue, blue, blue, blue] and so on. Sometimes it also skips more than one color.
I can't find a solution, i tried to modify the setTimeout timings but it has not solved the problem.
Can someone please help? I would be really grateful.