Aditya Singh Aditya Singh - 9 months ago 55
Javascript Question

How to generate range of numbers from 0 to n in ES2015 only?

I have always found the

function missing from JavaScript as it is available in python and others? Is there any concise way to generate range of numbers in ES2015 ?

EDIT: MY question is different from the mentioned duplicate as it is specific to ES2015 and not ECMASCRIPT-5. Also I need the rnage to be starting from 0 and not specific starting number (though it would be good if that is there)


You can use the spread operator on the keys of a freshly created array.