Tic Tac Toe re-written in JavaScript