Skip to content

findLastIndex<T>

Finds the index of the last element matching a predicate, scanning from the end.

Import:

import 'obsidian-test-mocks/setup';

Signature:

function findLastIndex(this: T[], predicate: (value: T) => boolean): number

Parameters:

Parameter Type Description
this T[]
predicate (value: T) => boolean Called with each element; the scan stops at the first one it returns true for. undefined elements are skipped without calling it.

Returns: number — The index of the last matching element, or -1 when none matches.