Snake game in javascript