title: How to handle an async function that depends on multiple other async functions
body: <p>I have an asynchronous function that works with the result of two other async functions.</p>
  
  <p>Till now what I was doing is that I write function2 in the callback function1 and function2 in the callback of function2</p>
  
  <pre><code>function1(callbackFunction() {
      function2(callbackFunction() {
          function3()
      })
  })
  </code></pre>
  
  <p>Is there any other way to handle this. I work usually with JavaScript code in client side and in nodeJs.</p>
  
  <p>My scenario is that for function2 I don't need output from function1. In another words function1 and function2 are independent; but function3 is dependent on function1 and function2.</p>
  
  <p>I want my function2 to run independent on function1 but function3 to run dependent on both functio1 and function2.</p>
  
  <p>Is there anything like</p>
  
  <pre><code>function1();
  function2();
  when(funtion1.complete &amp;&amp; funtion2.complete) {
      function3();
  }
  </code></pre>