range
declare function range(start: number, end: number, step?: number): number[];
declare function range(start: number, end: number, step?: number): number[];
Yields the numbers in the given range as an array
Example
Basic rangerange(3, 5); // [3, 4, 5]
range(3, 5); // [3, 4, 5]
Example
Range with a steprange(3, 10, 2); // [3, 5, 7, 9]
range(3, 10, 2); // [3, 5, 7, 9]
Name | Type | Optional | Description |
---|---|---|---|
start | number | No | The start of the range |
end | number | No | The end of the range (inclusive) |
step | number | Yes | The amount to increment between each number |