-
-
Save kelp404/7409202 to your computer and use it in GitHub Desktop.
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.remByVal = function(val) { | |
for (var i = 0; i < this.length; i++) { | |
if (this[i] === val) { | |
this.splice(i, 1); | |
i--; | |
} | |
} | |
return this; | |
}; | |
//Call like | |
[1, 2, 3, 4, 3].remByVal(3); |
Author
kelp404
commented
Nov 11, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment