Javascript Array remove(ele)

Description

Javascript Array remove(ele)



Array.prototype.remove = function(ele){
 // body... //from  w ww.  j a v  a  2s .c  o m
 var i=0,n=0;
 // var arrSize=this.length;
 for(i=0;i<this.length;i++){
  if(this[i]!=ele){
   this[n++]=this[i];
  }
 }
 if(n<i){
  this.length=n;
 }
};



PreviousNext

Related