title: why isn't this while loop calling its inner functions?
body: <p>I'm trying to write a function that will take 3 urls as command line arguments and log their contents in the correct order.</p>
  
  <p>I use a while loop so I can block execution of http.get before its contents have been logged on the END even of response.</p>
  
  <pre><code>var http = require('http')
  
  var url1 = process.argv[2]
  var url2 = process.argv[3]
  var url3 = process.argv[4]
  
  var urls = [url1, url2, url3]
  
  
  while (urls.length&gt;0){
      var url = urls[0]
      http.get(url, function callback(response){
      var chars = ""
      response.on('data', function(data){
          chars+=data.toString()
      })
      response.on('end', function(err){
          console.log(chars)
          urls.shift()
      })
      })
  }
  </code></pre>
  
  <p>I must be doing something very wrong, because code causes an infinite loop (apparently urls.shift() isn't called).  Can anyone explain the error?</p>