I was coding a snake game in js, and I found a code in which there is so
for (let i = snakeArr.length - 2; i>=0; i--) {
snakeArr[i+1] = {...snakeArr[i]};
}
in the above code what does {...snakeArr[i]} means can anyone tell what it is and what's it's purpose what are it's pros and cons
This is the snake array
let snakeArr = [
{x: 13, y: 15}
];