Function findLastIndex

Finds the index of the last element in the source array that satisfies the provided predicate function.

Returns -1 if no element satisfies the predicate.

const findLastPositiveIndex = findLastIndex((x: number) => x > 0);
const a = findLastPositiveIndex([1, 2, 3]); // 2
const b = findLastPositiveIndex([-1, 0, -2]); // -1