Javascript Array erase(item)

Description

Javascript Array erase(item)


Array.prototype.erase = function (item) {
  for (var i = this.length; i--; i) {
    if (this[i] === item) this.splice(i, 1);
  }/*from www .  j  a  v  a  2s . c  o m*/

  return this;
};

Javascript Array erase(item)

Array.prototype.erase = function(item) {
    for (var i = this.length; i--;) {
        if (this[i] === item) this.splice(i, 1);
    }//from   w  ww .  j  a v  a 2 s  .c  o  m
    return this;
}



PreviousNext

Related