title: Node.js how to know when all async functions are done?
body: <p>This is my function:</p>
  
  <pre><code>var Tick = () =&gt; {
      binance.prices((error, ticker) =&gt; {
          for (var key in ticker) {
              if(key.includes('BTC')) {
                  // Cryptocurrency can be bought with BTC
                  var currency = {
                      price: ticker[key],
                      symbol: key
                  }
                  tickerModule.getOne(currency, function(err, rows) {
                      if (err) return console.log(err);
                  });
              }
          }
          console.log('done?');
      });
  }
  </code></pre>
  
  <p>I would expect that the console.log would execute after the async function inside but unfortunatly this isn't the case. How can I know when all async functions inside this function are done?</p>
  
  <p>I've been struggling with this issue for a few days now, I hope someone can help me out with this. </p>
  
  <p>Edit: I know I can use the callback function that gets triggered after the tickerModule.getOne however I want to know when all the async functions are done, not when 1 of them is done.</p>