Skip to content

Instantly share code, notes, and snippets.

@neonsamurai
Created February 15, 2014 00:27
Show Gist options
  • Save neonsamurai/9012449 to your computer and use it in GitHub Desktop.
Save neonsamurai/9012449 to your computer and use it in GitHub Desktop.
JavaScript: Get index of an object in an Array by key/value pair.
function getIdx(list, key, val){
return _.chain(list).pluck(key).indexOf(val).value();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment