Tic-tac-toe game written in javascript