Array.prototype.find returns the first element that satisfies a test, or undefined if none does. Its sibling findLast does the same from the other end. The key distinction from findIndex is right there in the return: find hands you the matching value, not its position.
Implement find(arr, predicate, thisArg) and findLast(arr, predicate, thisArg). find scans left to right and returns the first element where predicate is truthy; findLast scans right to left and returns the last such element. Both return undefined when nothing matches.
function find(arr, predicate, thisArg) { /* first matching ELEMENT or undefined */ }
function findLast(arr, predicate, thisArg) { /* last matching ELEMENT or undefined */ }
// predicate: (value, index, array) => boolean
find([1, 2, 3, 4], (n) => n > 2); // 3 — first element greater than 2
find([1, 2, 3], (n) => n > 10); // undefined
findLast([1, 2, 3, 4], (n) => n < 4); // 3 — last element less than 4
find([{id:1}, {id:2}], (o) => o.id === 2); // { id: 2 }
findIndex when you need the position.findLast goes backward — start at the last element and move toward the first.undefined — not -1 (that's findIndex) and not an error.forEach/map, find does not skip holes; a hole reads as undefined and is tested.(value, index, array), with thisArg as this when provided.