title: how to build an array with promise?
body: <p>I'm trying to loop and build an array...starting with "0" and end under '10'...all i'm getting right now is an array size of 1 for each loop even when i is incremented.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(function loop( ii) {
      if (ii &lt; 10) new Promise((resolve, reject) =&gt; {
          setTimeout( () =&gt; {
              arry.push(ii);
              console.log(ii+" "+arry+' '+arry.length);
              resolve();
          }, Math.random() * 1000);
      }).then(loop.bind(arry = [], ii+1));
  })(0);</code></pre>
  </div>
  </div>
  </p>