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:
You may use underscore library. It contains dozens of useful functions for working with arrays and many more.