Get a subarray from start (inclusive) to end (exclusive).
Returns a new array containing the elements in the requested range.
Negative indexes count from the end of the array, so -1 is the last
element, -2 is the second-to-last element, and so on.
If start is omitted, it defaults to 0. If end is omitted, it
defaults to the length of the array.
It is an error to omit both start and end. Arrays are immutable, so
there's no need to copy the whole array.
Arguments
| Name | Type | Description | Required |
|---|---|---|---|
array | [any] | The array to slice. | Yes |
start | number(_) | The starting index (inclusive). Defaults to 0. | No |
end | number(_) | The ending index (exclusive). Defaults to the array length. | No |
Returns
[any]