Create Array from Generator in JavaScript
<p><strong>I want to create an array from the values of an generator</strong> in JavaScript.
The generator creates a sequence of dynamic length like this</p>

<pre><code>function* sequenceGenerator(minVal, maxVal) {
    let currVal = minVal;

    while(currVal &lt; maxVal)
        yield currVal++;
}
</code></pre>

<p>I want to store those values in an array but using <code>next()</code> until the generator is done does not seem to be the best way possible (and looks quite ugly to be honest).</p>

<pre><code>var it, curr, arr;

it = sequenceGenerator(100, 1000);
curr = it.next();
arr = [];

while(! curr.done){
    arr.push(curr.value);
}
</code></pre>

<p>Can I somehow create an array directly from/within the generator? 
If not, can I somehow avoid/hide the loop? Maybe by using <code>map</code> or something like that?</p>

<p>Thanks in advance.</p>