function moveSnake(squares) {
let tail = currentSnake.pop();
squares[tail].classList.remove("snake");
currentSnake.unshift(currentSnake[0] + direction);
// movement ends here
eatApple(squares, tail);
squares[currentSnake[0]].classList.add("snake");
}