Javascript Array remove(arg)

Description

Javascript Array remove(arg)



Array.prototype.remove = function(arg){
 var i=0,n=0;/*w ww. jav a 2  s.c om*/
 var arrSize = this.length;
 for(i=0;i<arrSize;i++){
  if(this[i] != arg){
   this[n++]=this[i];
  }
 }
 if(n<i){
  this.length = n;
 }
};



PreviousNext

Related