Nodejs Array Remove Item remove(item)

Here you can find the source of remove(item)

Method Source Code

Array.prototype.remove = function (item) {
   var i = this.indexOf(item);
   if (i != -1)/*  w ww. jav a 2 s . c  o m*/
      this.splice(i, 1);
};

Related

  1. remove(item)
    Array.prototype.remove = function(item) {
      var index = this.indexOf(item);
      if (index !== -1) {
        this.splice(index, 1);
    };
    
  2. remove(item)
    Array.prototype.remove = function (item) {
        var i = 0;
        for(i = 0; i < this.length; i++) {
            if(this[i] == item)
                break;
        this.splice(i, 1);
    
  3. remove(item)
    Array.prototype.remove = function(item) {
      var j = 0;
      while (j < this.length) {
        if (this[j] == item) {
        this.splice(j, 1);
        } else { j++; }
    };
    
  4. remove(item)
    Array.prototype.remove = function(item) {
        var idx = this.indexOf(item);
        if( idx != -1 )
            this.splice(idx, 1);
        return this;