jty
    Preparing search index...

    Function isArrIdx

    • Checks if x is a valid array index for arr.

      Parameters

      • arr: unknown

        The array to check against.

      • x: number

        The value to check if it's a valid index.

      Returns x is number

      true if x is a valid index for arr, false otherwise.

      if arr is not an array.

      isArrIdx(['a', 'b'], 1) => true
      isArrIdx(['a', 'b'], 2) => false
      isArrIdx(['a', 'b'], -1) => false
      isArrIdx(['a', 'b'], 0.5) => false