title: How to Sync call in Node.js
body: <p>I have following code snippet: </p>
  
  <pre><code>var  array = [1, 2, 3];
  var data = 0;
  for(var i=0; i&lt;array.length; i++){
    asyncFunction(data++);
  }
  console.log(data);
  executeOtherFunction(data);
  </code></pre>
  
  <p>I am expecting value of data as 3 but I see it as 0 due to <code>asyncFunction</code>. How do I call <code>executeOtherFunction</code> when all the <code>asyncFunction</code> calls are done?</p>