const letters = ['a', 'b', 'c', 'b'];
const lastIndexOfB = Arr.findLastIndex(letters, (letter) => letter === 'b');
// eslint-disable-next-line unicorn/prefer-array-index-of
const notFound = Arr.findLastIndex<string>((letter) => letter === 'z')(letters);
assert(lastIndexOfB === 3);
assert(notFound === -1);
Finds the index of the last element that satisfies a predicate.
const letters = ['a', 'b', 'c', 'b'];
const lastIndexOfB = Arr.findLastIndex(letters, (letter) => letter === 'b');
// eslint-disable-next-line unicorn/prefer-array-index-of
const notFound = Arr.findLastIndex<string>((letter) => letter === 'z')(letters);
assert(lastIndexOfB === 3);
assert(notFound === -1);
Finds the index of the last element that satisfies a predicate.