Function findLastIndex

  • This method is like findIndex except that it iterates the collection from right to left.

    Returns

    The index of the found value, else -1

    Example

    let users = [
    { 'user': 'barney', 'active': true },
    { 'user': 'fred', 'active': false },
    { 'user': 'pebbles', 'active': false }
    ]

    findLastIndex(users, (o) => o.user == 'pebbles')
    // 2

    // The `shape` iteratee shorthand.
    findLastIndex(users, { 'user': 'barney', 'active': true })
    // 0

    // The `property` iteratee shorthand.
    findLastIndex(users, 'active')
    // 0

    See

    Type Parameters

    • T

    Parameters

    • arr: T[]

      The array to inspect.

    • fn: Iteratee<T, any, any>

      The function invoked per iteration.

    • Optional start: number

      The index to search from.

    Returns number

  • Type Parameters

    • T

    Parameters

    • arr: T[]
    • fn: Object
    • Optional start: number

    Returns number

  • Type Parameters

    • T

    Parameters

    • arr: T[]
    • fn: PropertyKey
    • Optional start: number

    Returns number

Generated using TypeDoc