Create a slice of an array subject to an optional step.
A new array with the specified values.
An exception if the slice step is 0.
step
0
Linear.
A start, stop, or step which is non-integral.
start
stop
import { ArrayExt } from '@lumino/algorithm';let data = [0, 3, 4, 7, 7, 9];ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]
The array-like object of interest.
The options for configuring the slice.
Generated using TypeDoc
Create a slice of an array subject to an optional step.
Returns
A new array with the specified values.
Throws
An exception if the slice
stepis0.Complexity
Linear.
Undefined Behavior
A
start,stop, orstepwhich is non-integral.Example