findLast()
findLast<
T
>(predicate
): (arr
) =>undefined
|null
|T
Returns the last element of the given array that satisfies the predicate. Returns null
otherwise.
Type Parameters
• T
Parameters
predicate
Predicate
<T
>
A predicate function to apply to each element of the array.
Returns
Function
Parameters
arr
T
[]
Returns
undefined
| null
| T
Remark
pure function
Example
findLast(x => !(x & 1))([1, 2, 3, 4, 5]);
// 4