title: Javascript: append to an array not working
body: <p>I am trying to append numbers that I get from an api call (a promise) into an array. When I test the array's length it's always returning 1 as if each api call resets the array and puts in a new number.</p>
  
  <p>here's the code:</p>
  
  <p>The API call</p>
  
  <pre><code> wiki()
    .page("COVID-19_pandemic_in_Algeria")
    .then((page) =&gt; page.fullInfo())
    .then((info) =&gt; {
      (data.confirmed.value = info.general.confirmedCases),
        (data.recovered.value = info.general.recoveryCases),
        (data.deaths.value = info.general.deaths);
  
     });
  
  const data = {
    confirmed: { value: 0 },
    deaths: { value: 0 },
    recovered: { value: 0 },
  };
  </code></pre>
  
  <p>Now I want to put the deaths count into an array, so that I have a list of numbers over the next days to keep track of.</p>
  
  <pre><code>  function countStats() {
    const counter = [];
    var deathCounter = data.deaths.value;
    counter.push(deathCounter);
    console.log(counter.length);
    return counter;
  }
  
  countStats();
  </code></pre>
  
  <p>every time the functions run (wiki() and countStats()) the counter array's length is always 1. Why is that?</p>