4 ms·
Wow, importing the whole lodash to use just one function? There’s es6 way of getting an array with a range of numbers: [...Array(100).keys()].map(v=>v+1)
by dkarbayev 8y ago
Wow, importing the whole lodash to use just one function? There’s es6 way of getting an array with a range of numbers:
[...Array(100).keys()].map(v=>v+1)
A little bit longer but no dependencies.
- mpfundstein 8y agoPretty cool trick mate. Didn’t know
- fangaorne 8y agoAlthough this method is pretty, I see 4 loops in this small line. a better way would be to only import the range method from lodash like so : import _range from "lodash/range";