array.slice
This function extracts a part an array by specifying a half-open range with start index and an end index (the element at the end index is excluded).
Syntax
array.slice(items, start, end)
Arguments
Argument |
Type |
Description |
---|---|---|
items |
array of type any |
Input array. |
start |
int |
Start index/position from which you want to extract the items from input array. |
end |
int |
End index/position till which you want the items to be extracted from the input array. |
Returns
Type |
Description |
---|---|
array of type any |
The extracted array with elements between the start and end position |
Examples
The function array.slice(array.create(1,2,3,4,5), 1, 3)
returns [2,3]
.