r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

7

u/action_jackosn Mar 19 '19

Array.from({length: 5}, (v, i) => i); := [0, 1, 2, 3, 4]

13

u/Darren1337 Mar 19 '19

I'm about to end this man's whole career.

[...Array(5).keys()]