Generatorsrangerange Callablerange(start: number, stop?: number, step?: number): Generator<number, void, unknown>Creates a generator of numbers from start to exclusive end. If the end end is not specified, the start will be interpreted as end, and the start will be set to 0. Examplecollect(range(5))// => [0, 1, 2, 3, 4]collect(range(0, 20, 5))// => [0, 5, 10, 15]for (const x of range(3)) { x // ?}// => 0, 1, 2 AlternativesLodash - rangeParametersstart: numberoptionalstop: numberThe end of the range (exclusive).step: number = 1Returns Generator<number, void, unknown>The range generator.
Creates a generator of numbers from start to exclusive end. If the end end is not specified, the start will be interpreted as end, and the start will be set to 0.
Example
Alternatives