var allCoords = [{ x: 2, y: 3 }, { x: 3, y: 4 }];
var emptySpaces = allCoords;
emptySpaces.splice(0, 1);
console.log(allCoords.length);
console.log(emptySpaces.length);
I do not understand why both of these output "1". Why is the original array, allCoords
being modified, when I only want the second one, emptySpaces
to be edited?