Skip to content

Instantly share code, notes, and snippets.

@oguzhanaslan
Created May 29, 2018 12:24
Show Gist options
  • Save oguzhanaslan/61319f4a97ecd97e7791c0d1804fa313 to your computer and use it in GitHub Desktop.
Save oguzhanaslan/61319f4a97ecd97e7791c0d1804fa313 to your computer and use it in GitHub Desktop.
find() vs _.find
var users = [
{ 'user': 'oğuzhan', 'age': 36, 'active': true },
{ 'user': 'aslan', 'age': 41, 'active': false },
{ 'user': 'can', 'age': 14, 'active': false },
{ 'user': 'mehmet', 'age': 16, 'active': true },
{ 'user': 'ahmet', 'age': 11, 'active': true },
];
// lodash
_.find(users, function (o) { return o.age < 40; })
// native JavaScript
users.find(function (o) { return o.age < 40; })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment