title: Javascript : data loaded in a Promise not available after the Promise is completed
body: <p>I am trying to load some data into records array inside a Promise and trying to access after the Promise is completed:</p>
  
  <pre><code>records = [];
  
  Promise.all([
      d3.dsv(",", "state-earthquakes.csv", d =&gt; records.push(d)),
      d3.json("states-10m.json").then(d=&gt;LoadMap(d))
  ]).then(UpdateData());
  
  function UpdateData()
  {
      console.log(records);
      console.log(records.length);    
  }   
  </code></pre>
  
  <p>When I run this, <code>records</code> is shown as empty, which is not expected (the file has data).
  When I examine records from the console, I see all the records:</p>
  
  <p><a href="https://i.stack.imgur.com/2frbE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2frbE.png" alt="enter image description here"></a></p>
  
  <p>What explains this behavior?</p>
  
  <p>I need to process the records after both method calls in the Promise are completed. How do I achieve this?</p>