Code skill Adding the Snake

This piece of code draws the snake on the board. It uses object literals to represent each part of the snake, giving each part an X and Y coordinate. You will also add a property to control the snake’s direction, and a drawSnake function to draw the snake on the game board.

See the Pen GB3 M2 by Walker Books UK (@walkerbooks) on CodePen.