Powered By GitBook
INSERT_ITEM_AT
Insert item in list at the given index

Description

Return a copy of the list where a new item is inserted at the given index, pushing any following items to greater indexes.
If the index is negative, then the insertion position is counted from the end of the list

Function signature

1
INSERT_ITEM_AT(array: Array, index: Number, newitem: ) => Array
Copied!
Parameter
Description
Array
List
index
Index at which the item will be inserted
newItem
Item to insert

Examples

1
numbers = [1,2,3]
2
objArr = [{"a":1},{"a":2},{"a":3}]
3
newItem = {"a":0}
Copied!
Formula
Return value
INSERT_ITEM_AT(numbers, 1, 999)
[1,999,2,3]
INSERT_ITEM_AT(numbers, 10, 999)
[1,2,3,999]
INSERT_ITEM_AT(numbers, -1, 999)
[1,2,999,3]
INSERT_ITEM_AT(objArr, -10, newItem)
[{"a":0},{"a":1},{"a":2},{"a":3}]
Last modified 10mo ago
Export as PDF
Copy link