Function lastIndex

Returns the index of the last element in the array where predicate is true, and None otherwise.

  • Type Parameters

    • T

    Parameters

    • arr: T[]

      An array

    • predicate: (value: T, index: number, array: T[]) => boolean

      lastIndex calls predicate once for each element of the array, in backward order, until it finds one where predicate returns true.

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns Option<number>

    The index of the last item that matches the predicate, or None if no item matches.