title: How to send result of a function after the loop is finished?
body: <p>In a Node/Express server in CoffeeScript, I have the following function : </p>
  
  <pre><code>@resolveServers = (url, servers, answer) -&gt;
    result = []
    treatServer(url, server, (treatAnswer) -&gt;
      result.push(treatAnswer)
    ) for server in servers
    answer(result)
  </code></pre>
  
  <p>The treatServer method take some times, and the answer is send before the loop is finish. How can I send the result only when the loop is come at an end ?</p>
  
  <p>Thanks for the help.</p>