River Ray @ leizhenpeng.com

Range in JavaScript

Sep 13, 2021 · 1min

Credit to GitHub Copilot.

I didn’t know you could provide a map function to Array.from as a second argument until today.

Array.from({ length: 10 }, (_, i) => i)
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
> comment on mastodon / twitter
>
CC BY-NC-SA 4.0 2024-PRESENT © River Ray