Small Tic Tac Toe implementation in JavaScript