Generates an array of numbers from 0 to n - 1.

Type signature

(n: number) => number[]

Examples

range(3);
// ⇒ [0, 1, 2]
Try in REPL

Questions

  • How to create an array of all integers from 0 to N exclusive?

TypeScript sourceJavaScript source