Returns a new array, from the start position up to the count of elements.
arraySlice(array, offset, length)
returns array
someArray.slice(offset, length)
Name | Type | Required | Default | Description |
---|---|---|---|---|
array | array | Yes | Name of the array that you want to slice | |
offset | numeric | Yes | Specifies the position from which to slice the array. Negative value indicates that the array is sliced, with sequence starting from array’s end. | |
length | numeric | No | Maximum elements to slice |
array = [1, 2, 3, 4, 5, 6, 7, 8];
newArray = arraySlice(array, 2, 3);
writedump(newArray)
array = [1, 2, 3, 4, 5, 6, 7, 8];
newArray = arraySlice(array, 4);
writedump(newArray)
array = [1, 2, 3, 4, 5, 6, 7, 8];
newArray = arraySlice(array, -5, 3);
writedump(newArray)
CF11+ calling the slice member function on an array.
array = [1, 2, 3, 4, 5, 6, 7, 8];
newArray = array.slice(2, 3);
writedump(newArray)