Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Forked from HiveSolution/array_remove.js
Created March 31, 2016 11:26
Show Gist options
  • Save hsleonis/8ee5d03119c78e3a62838044f0e8f3c4 to your computer and use it in GitHub Desktop.
Save hsleonis/8ee5d03119c78e3a62838044f0e8f3c4 to your computer and use it in GitHub Desktop.
Simple prototype ext. for array to remove elements
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