切割数组得到头部
> let a = [1, 2, 3, 4, 5, 6]
> a.slice(2)
[3, 4, 5, 6]
> a.splice(2)
[3, 4, 5, 6]
根据索引切取指定范围内的数组
> let arr = [1, 2, 3, 4, 5, 6]
> arr.slice(2, 5)
[3, 4, 5]
切割数组得到尾部
eg: 切割数组后面的几个
> let arr = [1, 2, 3, 4, 5, 6]
> arr.slice(2)
[3, 4, 5, 6]
标签:arr,slice,切割,JS,let,数组
From: https://www.cnblogs.com/openmind-ink/p/17219714.html