Skip to content

Instantly share code, notes, and snippets.

@devhero
Created August 30, 2017 09:53
Show Gist options
  • Save devhero/5d917ed91190649d62a9ae37c9021751 to your computer and use it in GitHub Desktop.
Save devhero/5d917ed91190649d62a9ae37c9021751 to your computer and use it in GitHub Desktop.
find the index of an object in an array
var elementPos = array.map(function(x) {return x.id; }).indexOf(idYourAreLookingFor);
var objectFound = array[elementPos];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment