📅  最后修改于: 2022-03-11 15:01:23.803000             🧑  作者: Mango
// how to copy all elements in an array except for the first one in javascript
const tail = arr => (arr.length > 1 ? arr.slice(1) : arr);
console.log(tail([1, 2, 3])); // [2, 3]
console.log(tail([1])); // [1]