Skip to content

Instantly share code, notes, and snippets.

@gautier-levert
Last active August 29, 2015 14:07
Show Gist options
  • Save gautier-levert/be37ac58582ed4e7d0c0 to your computer and use it in GitHub Desktop.
Save gautier-levert/be37ac58582ed4e7d0c0 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