Powered By GitBook
SPLICE
Removes the given number of items from a list at the given index, and then adds the given items there

Description

Return given list wherein removes the given number of items from a list at the given index, and then adds the given items there.

Function signature

1
SPLICE(array: Array, index: Number, removecount: Number, newitems: Array) => Array
Copied!
Parameter
Description
Array
Given list
index
Item start index for insertion and removing
removeCount
Quantity removing items
newItems
List of items to insert

Examples

1
array = [{"a":1},{"a":2},{"a":4}]
2
items = [{"a":3},{"a":2},{"a":1}]
3
emptyArray = []
4
numbers = [1,2,3]
Copied!
Formula
Return value
SPLICE(array, 2, 1, items)
[{"a":1},{"a":2},{"a":3},{"a":2},{"a":1}]
SPLICE(array, 2, 0, items)
[{"a":1},{"a":2},{"a":3},{"a":2},{"a":1},{"a":4}]
SPLICE(array, -1, 1, items)
[{"a":1},{"a":2},{"a":3},{"a":2},{"a":1}]
SPLICE(emptyArray, 1, 0, numbers)
[1,2,3]
Last modified 10mo ago
Export as PDF
Copy link