Function findIndex

  • Finds the index of the first element in an array that satisfies a given callback function.

    Returns

    the index of the first element that satisfies the callback function, or null if no element satisfies the callback function

    Type Parameters

    • T

    Parameters

    • array: T[]

      the input array

    • callback: ((element: T, index: number, array: T[]) => boolean)

      the function to test each element with

        • (element: T, index: number, array: T[]): boolean
        • Parameters

          • element: T
          • index: number
          • array: T[]

          Returns boolean

    Returns number | null

Generated using TypeDoc