Tic Tac Toe | Unable to chain my events properly

Tic Tac Toe | Unable to chain my events properly
0

#1

(http://codepen.io/bhanoday10307/full/BWPOzB/)

My tic tac toe game is working as expected but the only thing that bother’s me is when i find that the game is over I wrote a method which announces the winner by highlighting the 3 cells (which made him win). Which is getting executed very quick that the user is unable to look at that.

Any help/suggestions would be highly appreceated


#2

I used a different approach so it’s hard for me to work through your code.

On mine, after declaring a winner (or draw or loose), I just put up a button for the user to reset and waited for that to be clicked before continuing. If it must be time based, then I would think you would put whatever function resets the board into the callback of the setTimeout.


#3

Yes, I would do as ksjazzguitar said. Just put a setTimeout when the game is over, in the callback call new game and everything should work fine