Javascript Array removeByObj(obj)

Description

Javascript Array removeByObj(obj)

Array.prototype.removeByObj = function(obj) {
 for(var i = 0 ; i < this.length ; i++) {
  if(this[i] === obj) {
   this.splice(i,1);//from   ww w . jav a2s . c  om
   break;
  }
 }
};



PreviousNext

Related