Skip to content

Instantly share code, notes, and snippets.

@guangningyu
Last active November 12, 2018 03:56
Show Gist options
  • Save guangningyu/453d53361f78955f52b725dc856f2ccf to your computer and use it in GitHub Desktop.
Save guangningyu/453d53361f78955f52b725dc856f2ccf to your computer and use it in GitHub Desktop.
// Filter object array based on attributes
var foo = [{'a':1, 'b':2}, {'a':2}, {'a':1}]
foo.find(o => o.a === 1) // return { a: 1, b: 2 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment