title: javascript async populate array
body: <p>I want to understand how to write my own async functions.</p>
  
  <p>So how can I populate the array with a lot of elements <strong>async</strong> and see <strong>'finish'</strong> line without delay, instead of waiting the population to complete ?</p>
  
  <p>Here is the example of which I tried to implement Promises and callbacks but didn't succeed.</p>
  
  <pre><code>let arr = [];
  
  populateAsync(arr);
  console.log('finish');
  
  function populateAsync(arr) {
      // somehow populate arr async till it reaches
      // 100000000 elements (big enough to make a delay)
  } 
  </code></pre>