Nodejs Utililty Methods Array Remove From To

List of utility methods to do Array Remove From To

Description

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

Method

remove(from, to)
Array.prototype.remove = function (from, to) {
    var t = this.slice((to || from) + 1 || this.length);
    this.length = from < 0 ? this.length + from : from;
    return this.push.apply(this, t);
}; 
removeElement(from, to)
'use strict';
Array.prototype.removeElement = function(from, to) {
  const rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  this.push(...rest);
  return this;