File size: 332 Bytes
21dd449 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/**
* One param: create list of integers from 0 (inclusive) to n (exclusive)
* Two params: create list of integers from a (inclusive) to b (exclusive)
*/
export function range(n: number, b?: number): number[] {
return b
? Array(b - n)
.fill(0)
.map((_, i) => n + i)
: Array(n)
.fill(0)
.map((_, i) => i);
}
|