spliceInsert
The spliceInsert() function inserts an array of elements at a precise index without deleting existing values.
Interactive example
Syntax
Classic signature
typescript
function spliceInsert<
GenericElement extends unknown
>(
input: readonly GenericElement[],
indexFrom: number,
elements: GenericElement[]
): GenericElement[]Curried signature
typescript
function spliceInsert<
GenericElement extends unknown
>(
indexFrom: number,
elements: GenericElement[]
): (input: readonly GenericElement[]) => GenericElement[]Parameters
input: Source array.indexFrom: Position at which to insert the new values.elements: Array of values to insert.
Return value
A new array containing the elements added at the requested index, with existing elements shifted.
See also
spliceDelete- Deletes a segmentspliceReplace- Replaces a segment with another
