title: XHR For Loop - Unexpected End of Input Error
body: <p>I am attempting to make multiple XHR requests to download a total of 3 JSON feeds. Unfortunately I am only able to get one transferComplete() to execute before I get hit with a unexpected end of input error. I have checked my syntax and as far as I can tell it looks good. Why is this happening?</p>
  
  <pre><code>function getJSON(){
      feedObject["url"]["0"] = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson",
      feedObject["url"]["1"] = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson",
      feedObject["url"]["2"] = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson";
  
      var xhr = [];
  
      for (a = 0; a &lt; 3; a++) {
  
          (function(a){
              xhr[a] = new XMLHttpRequest();
              xhr[a].addEventListener("load", transferComplete(a));
              xhr[a].open("GET", feedObject["url"][a], true);
              xhr[a].send(null);
  
              feedObject["quakesMag"][a] = [],
              feedObject["quakesPlace"][a] = [],
              feedObject["quakesTime"][a] = [];
          })(a);
  
      }
  
      function transferComplete(a) {
          // receiving data
          loadText.innerText = "Getting USGS Data "+(a+1)+ "/3";
          var response = JSON.parse(xhr[a].responseText);
          feedObject["quakesTitle"][a] = response["metadata"]["title"];
  
          for (var i = 0, len = response["features"].length; i &lt; len; i++) {
              if (response["features"][i]["properties"]["mag"] != null) {
                  quakes = [],
                  quakeCount = 0;
                  quakes.push(response["features"][i]);
              }
          }
  
          for (var x = quakes.length - 1; x &gt;= 0; x--) {
              var quake = quakes[x],
                  quakeCoord = quake["geometry"]["coordinates"],
                  quakeMag = quake["properties"]["mag"],
                  quakePlace = quake["properties"]["place"],
                  quakeTime = quake["properties"]["time"];
  
              quakeCount++;
  
              feedObject["quakesMag"][a].push(quakeMag);
              feedObject["quakesPlace"][a].push(quakePlace);
              feedObject["quakesTime"][a].push(quakeTime);
  
          }
  
          feedObject["quakesCount"][a] = quakeCount;
  
          if (a == 2){ renderData(); }
  
      }
  
  }
  </code></pre>