var colors=["red","green","blue","yellow","purple"];
var colors2=colors.slice(1);
var colors3=colors.slice(1,4);
alert(colors2);//green,blue,yellow,purple
alert(colors3);//green,blue,yellow//如果slice()方法的参数中有一个负数,则用数组长度加上该数来确定相应的位置。此例中,slice(-2,-1)与调用slice(3,4)得到的结果相同