Returns the last element of the source iterable that satisfies the optional predicate.
Element type produced by the source iterable.
Source iterable to enumerate.
Predicate receiving each element and its index; the most recent truthy match is returned.
The last element matching pred.
pred
Error Thrown when no element satisfies pred.
const result = _last([1, 2, 3, 4], (value) => value % 2 === 0);console.log(result); // 4 Copy
const result = _last([1, 2, 3, 4], (value) => value % 2 === 0);console.log(result); // 4
or using the curried version:
const result = pipeInto( [1, 2, 3, 4], last((value) => value % 2 === 0));console.log(result); // 4 Copy
const result = pipeInto( [1, 2, 3, 4], last((value) => value % 2 === 0));console.log(result); // 4
Returns the last element of the source iterable that satisfies the optional predicate.