Javascript Array remove(e)

Description

Javascript Array remove(e)


Array.prototype.remove = function(e) {
  for (var i = 0; i < this.length; i++)
    if (e == this[i]) return this.splice(i, 1);
}

Javascript Array remove(e)

Array.prototype.remove = function(e) {
  for (var i = 0, length = this.length; i < length; ++i) {
      if (this[i] === e) {
        this.splice(i, 1);//w w w.  ja  v  a 2 s .c om
      }
  }
};

Javascript Array remove(e)

Array.prototype.remove = function(e) {
    for (var i = 0; i < this.length; i++) {
        if (e == this[i]) { return this.splice(i, 1); }
    }/*from   w  w w . j  av a  2 s  .c  o m*/
};



PreviousNext

Related