In order to get the equivalent of a range function, do the following:
function range(i, startAt = 0) {
return [...Array(i).keys()].map(i => i + startAt);
}
Here's the corresponding TypeScript function:
export function range(i: number, startAt = 0): number[] {
return [...Array(i).keys()].map(i => i + startAt);
}
Adapted from:
Does JavaScript have a method like "range()" to generate a range within the supplied bounds?