Nodejs Utililty Methods Array Remove by Index

List of utility methods to do Array Remove by Index

Description

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

Method

remove(i)
Array.prototype.remove = function(i) {
    if (typeof i != "number")
        i = this.indexOf(i);
    this.splice(i,1);
    return i;
Array.prototype.insert = function(v, i) {
    if (arguments.length == 1)
        i = this.length;
...
remove(index)
Array.prototype.remove = function(index)
    this.splice(index,1);
};
remove(index)
Array.prototype.remove = function(index) {
  this.splice(index, 1);
  return this;
};
remove(index)
Array.prototype.remove = function(index) {
  return this.splice(index, 1);
remove(index)
'use strict';
Array.prototype.remove = function (index) {
  return this.splice(index, 1);
remove(index)
Array.prototype.remove=function(index){
  for(var i=0;i<this.length;i++){
    if(i==index){
      this.splice(i, 1);
      break;
remove(n)
Array.prototype.remove = function(n) {
  this.splice(this.indexOf(n), 1);
};
remove(n)
Array.prototype.remove = function(n){
  for(var i in this){
    if(this[i]==n){
      this.splice(i,1);
      break;
  return this;
remove(pos)
Array.prototype.remove = function (pos) {
    this.splice(pos, 1);
    return this;
};
remove(pred)
Array.prototype.remove = function(pred) {
  var removed = this.filter(function(item) {
    return pred(item)
  })
  this.forEach(function(i, index, arr) {
    if (removed.indexOf(i) !== -1) arr.splice(index, 1)
  })
  return removed
var arr = [1, 2, 3, 4, 5, 6]
var removed = arr.remove(function(e) {return e % 2 === 0})
console.log(arr)
console.log(removed)