Array.prototype.del=function(n){ //n表示第几项,从0开始算起。 //prototype为对象原型,注意这里为对象增加自定义方法的方法。 //如果n<0,则不进行任何操作。
if(n<0)
return this;
else
return this.slice(0,n).concat(this.slice(n+1,this.length));
};
Array.prototype.del=function(n){ //n表示第几项,从0开始算起。 //prototype为对象原型,注意这里为对象增加自定义方法的方法。 //如果n<0,则不进行任何操作。
if(n<0)
return this;
else
return this.slice(0,n).concat(this.slice(n+1,this.length));
};