Snake game written in javascript