Nodejs Utililty Methods Array Remove Object

List of utility methods to do Array Remove Object

Description

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

Method

removeById(id)
Array.prototype.removeById = function(id) {
    for(var i=0; i<this.length; i++) {
        if(this[i]._id == id) {
            this.splice(i, 1);
            break;
removeById(id)
Array.prototype.removeById = function(id) {
  for(var i = 0 ; i < this.length ; i++) {
    if(this[i].id == id) {
      this.splice(i,1);
      break;
};
removeObject(element)
Array.prototype.removeObject = function (element) {
    var i = this.indexOf(element);
    if (i != -1) {
        this.splice(i, 1);
};
removeObject(obj)
Array.prototype.removeObject = function(obj) {
  var index = this.indexOf(obj);
  if(index !== -1) {
    this.splice(index, 1);
Array.prototype.containsObject = function(obj) {
  return this.filter(item => item === obj).length !== 0;
removeObject(obj)
Array.prototype.removeObject=function(obj){
  for(var i=0;i<this.length;i++){
    if(this[i]==obj){
      this.splice(i, 1);
      break;
removeObject(object)
Array.prototype.removeObject = function(object)
    for (var i = 0; i < this.length; ++i)
        if (this[i] === object)
            this.remove(i);
            break;
Array.prototype.remove = function( from,  to)
  var rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  return this.push.apply(this, rest);
};
removeObject(object)
Array.prototype.removeObject = function(object)
    for (var i = 0; i < this.length; ++i)
        if (this[i] == object)
            this.remove(i);
            break;
removeObject(object)
Array.prototype.removeObject = function(object)
    for (var i = 0; i < this.length; ++i)
        if (this[i] === object)
            this.remove(i);
            break;
Array.prototype.remove = function( from,  to)
    var rest = this.slice((to || from) + 1 || this.length);
    this.length = from < 0 ? this.length + from : from;
    return this.push.apply(this, rest);
};
removeObject(object)
Array.prototype.removeObject = function(object)
    for (var i = 0; i < this.length; ++i)
        if (this[i] === object)
            this.remove(i);
            break;
removeObject(object)
Array.prototype.removeObject = function(object)
    for (var i = 0; i < this.length; ++i)
        if (this[i] === object)
            this.remove(i);
            break;