Skip to content

Instantly share code, notes, and snippets.

@luoyjx
Created September 29, 2019 03:16
Show Gist options
  • Save luoyjx/041b34cf1b41c538a1f151b7e4b58243 to your computer and use it in GitHub Desktop.
Save luoyjx/041b34cf1b41c538a1f151b7e4b58243 to your computer and use it in GitHub Desktop.
create array fast way
let f = length => Array.from({length}).map((v,k) => k);
@luoyjx
Copy link
Author

luoyjx commented Sep 29, 2019

result of f(8) will be

[0, 1, 2, 3, 4, 5, 6, 7]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment