Function lastIndexOf

Returns the last index at which a given value can be found in an array.

If the value is not found, -1 is returned.

const arr = [1, 2, 3, 4, 2, 5];
lastIndexOf(2)(arr); // 4
lastIndexOf(6)(arr); // -1
lastIndexOf(2, 3)(arr); // 4
  • Parameters

    • value: unknown
    • OptionalfromIndex: number

    Returns ((source: readonly unknown[]) => number)

      • (source): number
      • Parameters

        • source: readonly unknown[]

        Returns number