Created
October 23, 2013 15:20
-
-
Save wkronemeijer/7120728 to your computer and use it in GitHub Desktop.
Removes all instances of a element in an array
This file contains 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 (element) { | |
while (this.contains(element)) { | |
this.splice(this.indexOf(element), 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment