Skip to content

Instantly share code, notes, and snippets.

@chris-sev
Created December 21, 2018 17:13
Show Gist options
  • Save chris-sev/4a976283c650a047f6ca1c5484cdd149 to your computer and use it in GitHub Desktop.
Save chris-sev/4a976283c650a047f6ca1c5484cdd149 to your computer and use it in GitHub Desktop.
find() in array of objects
const people = [
{ name: 'chris', username: 'chrisoncode' },
{ name: 'nick', username: 'whatnicktweets' },
{ name: 'holly', username: 'hollylawly' },
];
people.find(person => person.name === 'holly');
// output: { name: 'holly', username: 'hollylawly' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment