Created
April 14, 2015 19:00
-
-
Save seangibat/3b041ed7cab603e13c58 to your computer and use it in GitHub Desktop.
javascript filter
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 filter = function(collection, predicate){ | |
var results = []; | |
each(collection, function(val){ | |
if (predicate(val)) results.push(val); | |
}); | |
return results; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment