DEV Community

Jonathan Armentor
Jonathan Armentor

Posted on


Generating an Inclusive Array Between Two Numbers

I wrote a simple little function using ES6 array methods to generate an inclusive array between two given numbers. Handy for a handful of applications.

Happy to get the community's feedback.

function sequential(to, from = 0) {
    return Array.from(Array(to + 1).keys()).slice(from)
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)

Need a better mental model for async/await?

Check out this classic DEV post on the subject.

⭐️🎀 JavaScript Visualized: Promises & Async/Await

async await