Tic Tac Toe JQRY Project Help[solved]

Hi campers,

What am I missing in my code? getWinner() function does not work properly. It shows only winner when `computerTurn===“X” . Please look up my project code and help me.

I would try using console.log statements to investigate where in your code you think the failure is.
For example, does it reach else if (!result && turn === “O”)?
If you set up a win condition for “O”, how many of the console.log statements you set up print to the console.
Since this condition is dependent on the result variable, you might want to console.log the value of this variable among other statements.

Your use of canvas is impressive!

1 Like

Thank you so much s_coder :slight_smile: I resolved the problem now. The problem was conditions for turn=“O” was also writen in statement block of “X” and same for turn=“X”.

1 Like