日期:2014-05-16  浏览次数:20335 次

js操作Array数组删除元素等操作
Array.prototype.clear=function(){ 
this.length=0; 
} 
Array.prototype.insertAt=function(index,obj){ 
this.splice(index,0,obj); 
} 
Array.prototype.removeAt=function(index){ 
this.splice(index,1); 
} 
Array.prototype.remove=function(obj){ 
var index=this.indexOf(obj); 
if (index>=0){ 
this.removeAt(index); 
} 
} 

?