Code skill Game Over

This piece of code uses an isWall function to identify if the snake has collided with the wall or island. If it has, then it will return gameover. If gameover is returned, the tick function will stop running, stopping the game and popping up an alert “Game Over!”.

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