findLast()
findLast<
T>(predicate): (arr) =>T|null|undefined
Returns the last element of the given array that satisfies the predicate.
Returns null otherwise.
Type Parameters
T
T
The type of array elements.
Parameters
predicate
Predicate<T>
A predicate function to apply to each element of the array.
Returns
(
arr):T|null|undefined
Parameters
arr
T[]
Returns
T | null | undefined
Remarks
pure function
Example
import { findLast } from '@accelint/core';
findLast(x => !(x & 1))([1, 2, 3, 4, 5]);
// 4