Winning the colors change game in JavaScript

In the previous lessons, we generally implemented the entire gameplay. It remains to make it so that the game determines the moment of victory.

After thinking about this question, we can come to the conclusion that the moment of victory is when all the cells have the same color. That is, technically - the same class.

This means that at the moment of clicking on any cell, you need to take the class of any cell (the one we clicked on will fit) and see if all other cells have this class.

If so, then that's it, a win. If not, keep playing.

Implement the task assigned.