const arr = [1, 3, 4, 5, 6, 8]; const result = _.find(arr, x => x % 2 === 0); console.log(result); // 4
const users = [ { id: 1, name: 'John', age: 30 }, { id: 2, name: 'Jane', age: 25 }, { id: 3, name: 'Bob', age: 35 } ]; const result = _.find(users, { name: 'Jane' }); console.log(result); // { id: 2, name: 'Jane', age: 25 }Here, we pass an object as the second argument to `find`, which tells it to look for an element in the array that has the `name` property equal to `'Jane'`. In both examples, we're using the `find` function from the Lodash library. You can tell it's Lodash because we're using the `_` symbol before the function name. Overall, Lodash provides many helpful utility functions like `find` that can make your JavaScript code more concise and readable.