Slice
A part of an array, from a start index up to an end index.
Node id array/slice
The Slice node outputs a new array with the elements of array from index
start up to, but not including, index end: on a, b, c, d, start 1 and
end 3 give b, c.
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| array | Array<T> | — | generic |
| start | number | 0 | |
| end | number | — |
Outputs
| Name | Type | Notes |
|---|---|---|
| array | Array<T> | generic |
Behaviour
- Defaults.
startdefaults to 0 (the beginning).endhas no default: unset, the slice goes to the end of the array. - Like JavaScript's
Array.slice. Negative indices count from the end (start -2 gives the last two elements). Indices past either end are limited to the array, and fractional ones are cut to whole numbers. - No errors. Where
endis not afterstart, the result is empty. - The array is unchanged.