A number representing the range to yield (exclusive) or an object with start, end and step
This method is end-exclusive, for example the last number yielded by range(5)
is 4. If you
prefer for the end to be included add 1 to the range or end
option.
Basic range
for (const number of range(5)) {
console.log(number);
}
// Prints 0, 1, 2, 3, 4
Range with a step
for (const number of range({ start: 3, end: 10, step: 2 })) {
console.log(number);
}
// Prints 3, 5, 7, 9
Generated using TypeDoc
A generator to yield numbers in a given range