Finds the last element in the source array that satisfies the provided predicate function.
Returns undefined if no element satisfies the predicate.
undefined
const findLastPositive = findLast((x: number) => x > 0);const a = findLastPositive([1, 2, 3]); // 3const b = findLastPositive([-1, 0, -2]); // undefined Copy
const findLastPositive = findLast((x: number) => x > 0);const a = findLastPositive([1, 2, 3]); // 3const b = findLastPositive([-1, 0, -2]); // undefined
Finds the last element in the source array that satisfies the provided predicate function.
Returns
undefinedif no element satisfies the predicate.Example