This could probably be solved if Javascript had map&#x2F;filter&#x2F;reduce functions for iterators (and hopefully dictionaries) as well as arrays.<p>And of course a range(start,stop,step) iterator similar to python&#x27;s range.<p>it would then be a matter of:<p><pre><code>  next = range(1,40000).map(x =&gt; x * 2);</code></pre>
and because range would be an iterator, the only array created would be next.