📅  最后修改于: 2022-03-11 15:02:03.590000             🧑  作者: Mango
// how to copy all the elements of an array except the last one in javascript
const initial = arr => arr.slice(0, -1);
console.log(initial([1, 2, 3])); // [1, 2]