Creates a Sequence of numbers from start (inclusive) to endExclusive (exclusive), advancing by step.
Sequence
start
endExclusive
step
A negative step produces a descending range.
The first value (inclusive).
The upper bound (exclusive).
The increment between values. Defaults to 1. Must not be 0.
1
0
range(1, 5).toArray(); // [1, 2, 3, 4]range(0, 10, 3).toArray(); // [0, 3, 6, 9]range(5, 1, -1).toArray(); // [5, 4, 3, 2] Copy
range(1, 5).toArray(); // [1, 2, 3, 4]range(0, 10, 3).toArray(); // [0, 3, 6, 9]range(5, 1, -1).toArray(); // [5, 4, 3, 2]
If step is 0.
Creates a
Sequenceof numbers fromstart(inclusive) toendExclusive(exclusive), advancing bystep.A negative
stepproduces a descending range.