Nodejs Array Remove Item remove(item)

Here you can find the source of remove(item)

Method Source Code

// Remove all occurrences of the given item from an array.
Array.prototype.remove = function (item) {
    var i = 0;//from   w w w.jav  a 2s. c o m
    while (i < this.length) {
        if (this[i] == item) {
            this.splice(i, 1);
        } else {
            i++;
        }
    }
    return this;
};

Related

  1. remove(item)
    Array.prototype.remove = function(item) {
        var items = []
        if (arguments.length > 1) {
            items = arguments;
        } else {
            items = [item];
        for (var i = 0; i < items.length; i++) {
            var index = this.indexOf(items[i]);
    ...
    
  2. remove(item)
    Array.prototype.remove = function(item) {
      for (var i = this.length; i--;)
        if (this[i] === item) this.splice(i, 1);
      return this;
    };
    
  3. remove(item)
    Object.defineProperty(Object.prototype, "extend", {
        enumerable: false,
        value: function(from) {
            var props = Object.getOwnPropertyNames(from);
            var dest = this;
            props.forEach(function(name) {
                    var destination = Object.getOwnPropertyDescriptor(from, name);
                    Object.defineProperty(dest, name, destination);
            });
    ...
    
  4. remove(item)
    Array.prototype.remove = function(item){
      var found = false;
      for(var i = 0; i < this.length; i++){
        if (this[i] == item){
          this.splice(i, 1);
          found = true;
          break;
      if (found == false){}
    
  5. remove(item)
    Array.prototype.remove = function (item) {
        var i;
        while((i = this.indexOf(item)) !== -1) {
            this.splice(i, 1);
    };
    
  6. remove(item)
    Array.prototype.remove = function(item) {
      var newArray = [];
      if (this.indexOf(item) === -1) {
        return this;
      } else {
        for (var i = 0; i < this.length; i++) {
          if (this[i] !== item) {
            newArray.push(this[i]);
      return newArray;
    };
    
  7. remove(item)
    Array.prototype.remove = function(item)
      var p = this.indexOf(item);
      if(p != -1)
        this.splice(p,1);
    };
    
  8. remove(item)
    Array.prototype.remove = function(item){
      if (this.contains(item)) return this.splice(this.indexOf(item), 1);
    
  9. remove(itemToRemove)
    Array.prototype.remove = function (itemToRemove) {
        var i,
            len = this.length;
        for (i = 0; i < len; i += 1) {
            if (this[i] === itemToRemove) {
                this.splice(i, 1);
    };
    ...