{ // 通过length获取前面几项 let arr = [1,2,3,4] arr.length = 2 console.log(arr); // [1,2] } { // 通过splice获取前面几项 let arr = [1,2,3,4] console.log(arr.splice(0,2));// [1,2] } { // 通过splice获取后面几项 let arr = [1,2,3,4] console.log(arr.splice(-2));// [3,4] } { // 通过解构赋值获取后面几项 let arr = [1,2,3,4] let [a,b,...v] = arr console.log([...v]); // [3,4] }