• Category

    Get an array of indexes of holes in an array.

    Time complexity: O(n)

    Space complexity: O(n)

    Parameters

    • array: ArrayLike<unknown>

      The array to find holes in

    Returns number[]

    An array of indexes of holes in the array

    Array

    Example

    holes([0, , 2]); // [1]