Function step

  • Returns a new array with every n-th item from the input array.

    Since

    1.0.0

    Returns

    Stepped collection.

    Example

    step([1, 2, 3, 4, 5, 6], 2)
    // => [1, 3, 5]

    Type Parameters

    • TValue

    Parameters

    • array: readonly TValue[]

      Array to use.

    • stepSize: number

      Step to use.

    Returns TValue[]

Generated using TypeDoc