• Inserts values into an Array at the specified index

    Mutation

    Example

    Insert values 4 and 5 at index 1

    const array = [1, 2, 3];

    insertAt(1, 4, 5)(array);

    console.log(array); // 1, 4, 5, 2, 3

    Type Parameters

    • T

      the Array element type

    Parameters

    • index: RelativeIndex

      the index to insert the values

    • Rest ...values: T[]

      the values to insert

    Returns ((array: T[]) => void)

      • (array: T[]): void
      • Parameters

        • array: T[]

        Returns void

Generated using TypeDoc