Created
June 6, 2014 13:18
-
-
Save joelremix/bf437b987d1fed53062a to your computer and use it in GitHub Desktop.
_Javascript: find_item
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
//Underscore | |
//find item without knowing its position in array | |
//http://stackoverflow.com/a/11922384/372567 | |
_.find(data.items, function(item) { | |
return item.id === 2; | |
}); | |
// Object {id: 2, name: "bar"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment