Workshop › Snake › Step 16 of 28
When the new head lands on the food: add a point, place new food, and skip removing the tail, so the snake grows by one.
```js
let score = 0
snake.unshift(head)
if (head.x === food.x && head.y === food.y) {
score += 1
placeFood()
} else {
snake.pop()
}
```score counts eaten food.if asks: is the new head on the food (same column and same row)?pop, so the snake keeps its extra cell. No (else): remove the tail as before.let food write let score = 0.update, replace the snake.pop() line with the if ... else block.Skills: Collision detection
← Draw the food Never put food on the snake →