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:
Here's a small extension for one of the answers in case you need to specify both starting and ending position of the range:
let range = (start, end) => Array.from(Array(end + 1).keys()).slice(start);