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:
function range(start, stop) { if (typeof stop == 'undefined') { stop = start; start = 0; } result = [...Array(stop).keys()].slice(start, stop); return result; }