Build a new array instead of changing the old one.

Copying Arrays

copy_array.js
const extra = 4;
const copied = [...[1, 2, 3], extra].join(",");
const count = copied.split(",").length;

console.log("copied=" + copied);
console.log("count=" + count);
copy-array Immutable updates create a new value. Array spread is a common way to copy existing values and add one more item.