Finds the index of the last element that satisfies a predicate.
const letters = ['a', 'b', 'c', 'b'] as const;const lastIndexOfB = Arr.findLastIndex(letters, (letter) => letter === 'b');const notFound = Arr.findLastIndex<string>((letter) => letter === 'z')( letters,);assert.isTrue(lastIndexOfB === 3);assert.isTrue(notFound === -1); Copy
const letters = ['a', 'b', 'c', 'b'] as const;const lastIndexOfB = Arr.findLastIndex(letters, (letter) => letter === 'b');const notFound = Arr.findLastIndex<string>((letter) => letter === 'z')( letters,);assert.isTrue(lastIndexOfB === 3);assert.isTrue(notFound === -1);
Finds the index of the last element that satisfies a predicate.