Tic-Tac-Toe in JavaScript

I’ve bulit a simple tic-tac-toe game for 2 players, with option to reset and save how many times each player won. Unfortunately game stops working after 6th attempt (not include draws). I think it’s because I didn’t make seperate functions for every player, when I made those functions and tried to toggle between them, it didn’t work. It was something like this var flag = true; function toggleFunc(flag) { if(flag) { playerA(); } else { playerB(); } }


live site

You also get some illegal wins here or there. It’s almost there though!

Screen Shot 2021-05-19 at 11.00.30 AM