Function lastIndexOf

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

    Returns

    The index of the found value, else -1

    Example

    lastIndexOf([1, 2, 1, 2], 2)
    // 3

    // Search from the `fromIndex`.
    lastIndexOf([1, 2, 1, 2], 2, 2)
    // 1

    See

    Type Parameters

    • T

    Parameters

    • obj: T[]

      The array to inspect.

    • value: T

      The value to find

    • Optional start: number

      The index to search from.

    Returns number

Generated using TypeDoc