var a = [1,4,2,5,6,9,10];
console.log(a.slice(3)); //[5,6,9,10]
console.log(a.slice(-3)); //[6,9,10]
console.log(a.slice(2,4)); //[2,5]
console.log(a.splice(4)); //[6,9,10]
console.log(a); //[1,4,2,5]
//splice()方法是在数组中插入或删除元素的通用方法
//区别于slice的地方是:splice会改变原数组
var b = [1,4,2,5,6,9,10];
console.log(b.splice(-3)); //[6,9,10]
console.log(b); //[1,4,2,5]
console.log(b.splice()) //[]
console.log(b.splice(1,1,[1,2],4)); // [4]
console.log(b); //[1,[1,2],4,2,5]