Nodejs Utililty Methods Array Remove Item

List of utility methods to do Array Remove Item

Description

The list of methods to do Array Remove Item are organized into topic(s).

Method

remove(item)
Array.prototype.remove = function(item) {
    var i,
        len;
    for (i = 0, len = this.length; i < len; i += 1) {
        if (this[i] === item) {
            this.splice(i, 1);
            i -= 1;
    return this;
};
var arr = [1, 2, 1, 4, 1, 1, 3, 4, 1, 111, 3, 2, 1, '1'];
console.log('Original array');
console.log(arr);
console.log(arr.length);
console.log('Modified array without removed elements');
console.log(arr.remove(1));
console.log(arr.length);
remove(item)
Array.prototype.remove = function(item) {
  var index;
  while ((index = this.indexOf(item)) !== -1) {
    this.splice(index, 1);
  return this;
};
remove(item)
Array.prototype.remove = function(item){
  var i = this.indexOf(item);
  return this.splice(i, 1);
remove(item)
Array.prototype.remove = function(item) {
  var index;
  index = this.indexOf(item);
  if (index >= 0) {
    return this.splice(index, 1)[0];
  } else {
    return null;
};
...
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]);
...
remove(item)
Array.prototype.remove = function(item) {
  for (var i = this.length; i--;)
    if (this[i] === item) this.splice(i, 1);
  return this;
};
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);
        });
...
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){}
remove(item)
Array.prototype.remove = function (item) {
    var i;
    while((i = this.indexOf(item)) !== -1) {
        this.splice(i, 1);
};
remove(item)
Array.prototype.remove = function (item) {
    var i = 0;
    while (i < this.length) {
        if (this[i] == item) {
            this.splice(i, 1);
        } else {
            i++;
    return this;
};