To generate the array asked for by the OP:
[...Array(10).keys()]
Yields:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]