Skip to content

Instantly share code, notes, and snippets.

@joelremix
Created June 6, 2014 13:18
Show Gist options
  • Save joelremix/bf437b987d1fed53062a to your computer and use it in GitHub Desktop.
Save joelremix/bf437b987d1fed53062a to your computer and use it in GitHub Desktop.
_Javascript: find_item
//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