title: How do I wrap axios.get multiple response results into one array?
body: <p>Hi I am trying to combine the results of my axios get request into one array.</p>
  
  <p>I am grabbing data from Mongoose and MongoDB database which returns me an array of relevant information for the axios request to run through</p>
  
  <p>I run the info through axios.get and it returns me with respective results for each object in the array</p>
  
  <p>See below</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 axios = require("axios");
  
  var info = [500000, 2020, 12341234, 12341234]
  var algo = "cn8"
  
  console.log(info)
  
  
  for (var i = 0; i &lt; info.length; i++){
  
  var url = "https://whattomine.com/coins.json?" + algo + "=true" + "&amp;factor%5B" + algo + "_hr%5D=" + info[i]
  
  axios.get(url)
      .then((response) =&gt; {
        var result = response.data.coins.Monero.btc_revenue
        
        console.log(result)
        })
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>However I am also trying to write this result back into my MongoDB/Mongoose database for further logging and someone suggested I can use the map function to run the write functions going back into the database for it.</p>
  
  <p>However map only works for arrays and the results I am getting from axios are not. Does anyone have any idea how to join these response I am getting into one array?</p>
  
  <p>I have attached a picture below for reference</p>
  
  <p>Keep in mind these are the results for 
  console.log(info) is in GREEN for data going in</p>
  
  <p>console.log(result) is in RED for data supposed to be going out (need to transform into combined array first, not sure how to do when all the results are in one variable)</p>
  
  <p><a href="https://i.stack.imgur.com/tcY3q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tcY3q.png" alt="enter image description here"></a></p>