Skip to content

Instantly share code, notes, and snippets.

@tborychowski
Forked from danro/js-array-remove.js
Created October 10, 2012 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tborychowski/3864652 to your computer and use it in GitHub Desktop.
Save tborychowski/3864652 to your computer and use it in GitHub Desktop.
JS :: Array Remove
// Array Remove - By John Resig (MIT Licensed)
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);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment