Making the Snake Move
This piece of code will make your snake move. It uses the unshift method to add elements to the beginning of the snake array, and the pop method to remove the last element from the snake array. You will use the nextLocation function to work out where the snake is going to move to next.
See the Pen GB5 M2 by Walker Books UK (@walkerbooks) on CodePen.