Why not get really wild and crazy :P ?
1st define a unfoldr
const unfoldr = (f, seed, xs = , next = f(seed)) =>
next ? unfoldr(f, next, xs.concat(next)) : xs
then define a range in terms of unfold
const range = (from, to) =>
unfoldr(seed => seed > to ? false : [seed, seed + 1], from)
excellent article btw, keep them coming :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.