Remove array element from start index to ending index - Node.js Array

Node.js examples for Array:Remove Element

Description

Remove array element from start index to ending index

Demo Code


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);
};

Related Tutorials