Created
May 7, 2013 15:51
-
-
Save mauromarano/5533693 to your computer and use it in GitHub Desktop.
Search and remove an item from 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
var remove = function(array, value) { | |
var index = null; | |
while ((index = array.indexOf(value)) !== -1) | |
array.splice(index, 1); | |
return array; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment