Tic Tac Toe - Javascript help

Tic Tac Toe - Javascript help
0

#1

Hi, I am working on the Tic Tac Toe game on the front end development projects. I have a bug in my code and I can not work out how to fix it.

When either the user or program wins the game of tic tac toe, the program will take another turn and change another square to the symbol it is play as and I am not sure why this is happening.

Here is a link to the codepen https://codepen.io/mjl215/pen/qqmPpX?editors=1010

At the moment the current design is when the game is won a function alerting who has won will run, the alert is appearing but at the same time an extra square will be changed to a 0 or X and I can not work out how to stop this.

Does anyone know how I can fix this issue?

Thanks for your help.


#2

I’ll refer you to my earlier post

Take a break…


#3

Yeah, when I am stuck for a while I normally just try again the next day and can work it out eventually, but I have been stuck on this for a few days not really getting anywhere.