title: How do you make axios GET request wait?
body: <p>Hi I'm having a problem with using axios / fetch GET with a URL that has a parameter that iterates through an array loop for its values</p>
  
  <p>axios / fetch doesn't follow the order of the array and just returns whichever response comes first.</p>
  
  <p>How would I fix this?</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>const fetch = require("node-fetch");
  
  algo = "eth" // algorithm for wtt
  
  hashrate = ['250', '100', '50']
  
  console.log(hashrate)
  
  
  for (var i = 0; i &lt; vhr.length; i++){
  
  var wttURL = "https://whattomine.com/coins.json?" + algo + "=true" + "&amp;factor%5B" + algo + "_hr%5D=" + hashrate[i]
  
  
  
  fetch(wttURL)
  .then((resp) =&gt; resp.json()) // Transform the data into json
  .then(function(data) {
    console.log(data.coins.Ethereum.btc_revenue)
    })</code></pre>
  </div>
  </div>
  </p>
  
  <p>The output for this currently is either the results for 250 (a), 100 (b) or 50 (c)</p>
  
  <p>So basically it would either come out as  </p>
  
  <p>a, b, c (desired)</p>
  
  <p>b, c, a </p>
  
  <p>a, c, b</p>
  
  <p>c, b, a</p>
  
  <p>etc.</p>
  
  <p>But I want it to output according to the order so it should be </p>
  
  <p>a ,b ,c always</p>