JavaScript
Copy an array into a new array

by Benny Neugebauer

const original = [1, 3, 3, 7];
const copy = original.slice(0);
copy.pop();
console.log(original.length); // 4
console.log(copy.length); // 3

const original = [1, 3, 3, 7];
const copy = Array.from(original);
copy.pop();
console.log(original.length); // 4
console.log(copy.length); // 3