Skip to content

Instantly share code, notes, and snippets.

@nhducit
Created October 30, 2015 03:54
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 nhducit/086d31ceada22e2ddcc5 to your computer and use it in GitHub Desktop.
Save nhducit/086d31ceada22e2ddcc5 to your computer and use it in GitHub Desktop.
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);
};
http://ejohn.org/blog/javascript-array-remove/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment