Returns a new array with item inserted at index. Defaults to appending at the end.
item
index
The source array.
The item to insert.
Position to insert at (must be between 0 and array.length).
insertArrayItem([1, 2, 4], 3, 2) // => [1, 2, 3, 4]insertArrayItem([1, 2, 3], 4) // => [1, 2, 3, 4] Copy
insertArrayItem([1, 2, 4], 3, 2) // => [1, 2, 3, 4]insertArrayItem([1, 2, 3], 4) // => [1, 2, 3, 4]
Returns a new array with
iteminserted atindex. Defaults to appending at the end.