JavaScript implementation of TicTacToe game