Last active
March 31, 2016 11:26
-
-
Save HiveSolution/190924889b2f3e53b81d05a4158f0f8b to your computer and use it in GitHub Desktop.
Simple prototype ext. for array to remove elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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