javascript for the game