Below is a simple "Snake" game implemented in JavaScript. Use the A and D keys to turn the snake left and right. Collect the red "food" squares to increase the length of the snake, and thus the score. The game ends if the head of the snake runs into the outside wall of the playfield or part of the snake's body.

To see the code or to make a comment, visit https://thiscouldbebetter.wordpress.com/2015/06/01/a-snake-game-in-javascript/.