1. 获取数组的后三位

var data=["a1","a2","a3","a4","a5","a6"]
 
//得出的结果就是["a4","a5","a6"]
var arr=data.splice(-3)
2. 删除数组的后三位

var data=["a1","a2","a3","a4","a5","a6"]
 
//得出的结果就是["a1","a2","a3"]
var arr=data.splice(0, data.length - 3)

您已经阅读00:00:00欢迎留言评论,喜欢的话就为作者点个赞或者赏颗糖吧! 分享