This is the smallest, one-liner, solution for generating a range of numbers.
Replace n, from and step with the options you want. Here are a handful of examples:
Using TypeScript
In order for the above examples to work properly in TypeScript you will need to ensure the downlevelIteration option in your tsconfig has been enabled or you can use a slightly different variant as you can see below.
Here is the same examples from above, but with this slightly different variant that TypeScript is happy with.
Other examples
Range function
Generator function
This following generator function allows you to specify a start, step and a total count to generate.
This slightly different generator functions allows you to specify a start, end and step to generate.