Function findLast

  • This method is like find except that it iterates over elements of collection from right to left.

    Type Parameters

    • T

    Parameters

    • collection: ArrayLike<T>

      The collection to inspect.

    • Optionalpredicate: string

      The function invoked per iteration.

    • OptionalfromIndex: number

      The index to search from.

    Returns T | undefined

    Returns the matched element, else undefined.

    5.2.0

    [[find]],[[findIndex]],[[findKey]],[[findLastIndex]],[[findLastKey]]

    findLast([1, 2, 3, 4], n => n % 2 == 1)
    // => 3
  • Type Parameters

    • T

    Parameters

    • collection: ArrayLike<T>
    • Optionalpredicate: ((item: T) => boolean)
        • (item): boolean
        • Parameters

          • item: T

          Returns boolean

    • OptionalfromIndex: number

    Returns T | undefined

  • Type Parameters

    • T

    Parameters

    • collection: ArrayLike<T>
    • Optionalpredicate: Partial<T>
    • OptionalfromIndex: number

    Returns T | undefined

  • Type Parameters

    • T

    Parameters

    • collection: ArrayLike<T>
    • Optionalpredicate: any
    • OptionalfromIndex: number

    Returns T | undefined