title: javascript: execute a bunch of asynchronous method with one callback
body: <p>I need to execute a bunch of asynchronous methods (client SQLite database), and call only one final callback.</p>
  
  <p>Of course, the ugly way is:</p>
  
  <pre><code>execAll : function(callBack) {
          asynch1(function() {
              asynch2(function() {
                  ...
                  asynchN(function() {
                      callBack();
                  })
              })
          });
      }
  </code></pre>
  
  <p>But I know there are better ways to do it. Intuitively I would detect when all call back has been called with a counter to call the final callback.</p>
  
  <p>I think this is a common <strong>design-pattern</strong>, so if someone could point me in the right direction...</p>
  
  <p>Thanks in advance !</p>