Code skill Adding a Fruit

This piece of code creates a new fruit array with an X and Y property which is the location of the first fruit. In a drawFruit function, you will use the forEach method to draw the fruit on the board and colour it red.  As the drawFruit function is very similar to the drawSnake function, you will tidy the two functions into one draw function.

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