title: Node.js exercise, juggling Async from nodeschool.io
body: <p>I'm new in node and I'm stuck in an exercise of nodeschool.io, I can't understand why my solution is not valid, I have the sensation that I'm not realizing about something obvious, but I Can't figure out what it is!</p>
  
  <p>My solution:</p>
  
  <pre><code>var http = require('http');
  var bl = require('bl');
  var results = [];
  var count = 0;
  
  function printResults () {
      for (var i = 0; i &lt; 3; i++)
      console.log(results[i])
  }
  
  for(var i = 0; i &lt; 3 ; i++){
  http.get(process.argv[2 + i], function (response) {
      response.pipe(bl(function (err, data) {
          if (err)
              return console.error(err)
  
          results[i] = data.toString();
  
          count++
  
          if (count == 3)
              printResults()
          }))
  
      })
  }
  </code></pre>
  
  <p>Correct solution:</p>
  
  <pre><code>var http = require('http');
  var bl = require('bl');
  var results = [];
  var count = 0;
  
  function printResults () {
      for (var i = 0; i &lt; 3; i++)
      console.log(results[i])
  }
  
  function getDataa(i){
  http.get(process.argv[2 + i], function (response) {
      response.pipe(bl(function (err, data) {
          if (err)
              return console.error(err)
  
          results[i] = data.toString();
  
          count++
  
          if (count == 3)
              printResults()
          }))
  
      })
  }
  
  for(var i = 0; i &lt; 3 ; i++)
      getDataa(i);
  </code></pre>
  
  <p>Why when I put the for loop directly doesn't work?</p>
  
  <p>Thanks</p>