When I test the game, with every turn I take, more values get pushed into the user array. The only thing I can think of is that the function is running in more than one place. I can’t seem to fix it, though.
Hi, this code: $(".sect").click(function() { ... }) gets run multiple times (every time when it is the user’s turn). So it keeps adding event listeners. To prevent it from creating more than one event listener you could use .off() like this: $(".sect").off().click(function() { ... }). So first all event listeners on $(".sect") are removed and then a click event listener is added.