const users = [{ name: 'Alice', age: 30 }, { name: 'Bob', age: 25 }];
users.find(u => u.age < 28);
// { name: 'Bob', age: 25 }Array.find() returns the first element matching a predicate function.
This exercise focuses on finding an element that matches a condition (predicate). The Array.prototype.find() method returns the first element that satisfies the condition.
function findEven(arr: number[]): number | undefined {
// Return the first even number in the array
}
findEven([1, 3, 4, 5]) // 4
findEven([1, 3, 5]) // undefined