DEV Community

Discussion on: 🔥 Create number ranges in JavaScript

joshuakb2 profile image
Joshua Baker

I always copy and paste one of these:

function range(n) {
    let r = [];
    for (let i = 0; i < n; i++) r.push(i);
    return r;
Enter fullscreen mode Exit fullscreen mode
domhabersack profile image
Dom Habersack Author

Nice yes, putting this in a helper function is definitely the way to go.