range
Generates an array of sequential numbers from start to end (exclusive). If only one argument is provided, it generates numbers from 0 to that value.
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
startOrEnd | number | The start value (if end is provided) or end value (if end is omitted) |
end | number | The end value (exclusive) (optional) |
step | number | The increment between values (default: 1 or -1 depending on direction) (optional) |
Returns
Section titled “Returns”number[] — An array of sequential numbers
Examples
Section titled “Examples”Generate a sequence from 0
Section titled “Generate a sequence from 0”Creates an array of numbers from 0 to n-1 with a single argument.
Generate a sequence with start and end
Section titled “Generate a sequence with start and end”Creates an array from start (inclusive) to end (exclusive).
Generate a sequence with a custom step
Section titled “Generate a sequence with a custom step”Creates an array with a specified increment between values.
Generate a descending sequence
Section titled “Generate a descending sequence”Automatically produces a descending range when start > end.
