range es-toolkit
Creates an array of numbers within a specified range and step.
Usage
range(end)
Use range when you need a consecutive array of numbers from 0 to a specified end value. It's useful for loops.
Parameters
The end value (exclusive). Starts from 0.
Returns
Returns an array of numbers generated from 0 to the end value.
range(start, end, step?)
Use range when you need a consecutive array of numbers with a specified start value, end value, and step. It's useful for loops.
Parameters
The start value. Included in the result array.
The end value. Not included in the result array.
The increment between each number. Must be a non-zero integer. Defaults to 1.
Returns
Returns an array of numbers generated with the specified range and step.
Throws
- Throws an error if
stepis 0 or not an integer.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.