Is there a function in JavaScript similar to Python\'s range()?
range()
I think there should be a better way than to write the following lines every time:
For getting an array of size x, here's an one-liner without using any library
x
var range = n => Array(n + 1).join(1).split('').map((x, i) => i)
works as
> range(4) [0, 1, 2, 3]