Javascript Array removeByValue(value)

Description

Javascript Array removeByValue(value)


Array.prototype.removeByValue = function(value) 
{
 var idx = this.indexOf(value);
 if (idx != -1) /*from   ww  w  .jav a2s .com*/
 {
  return this.splice(idx, 1); // The second parameter is the number of elements to remove.
 }
 return false;
};



PreviousNext

Related