3 ms·
This could probably be solved if Javascript had map/filter/reduce functions for iterators (and hopefully dictionaries) as well as arrays. And of course a range
by dkopi 10y ago
This could probably be solved if Javascript had map/filter/reduce functions for iterators (and hopefully dictionaries) as well as arrays.
And of course a range(start,stop,step) iterator similar to python's range.
it would then be a matter of:
next = range(1,40000).map(x => x * 2);
and because range would be an iterator, the only array created would be next.