title: Dealing with Arrays of Deferred Objects
body: <p>Since using <code>$.Deferred</code> I've run into this scenario a couple times: I have a list of values each of which yields a Deferred Object in some way and I want to execute a callback once all of the Deferred Objects are resolved.</p>
  
  <p>A more concrete example would be something like this:</p>
  
  <pre><code>var urls = [ 'foo.com', 'bar.com', 'baz.com', 'qux.com' ],
      defers = [], defer;
  
  for( var i = 0, j = urls.length; i &lt; j; i++ ){
      defer = $.ajax({
          url: 'http://' + urls[ i ]
      });
  
      defers.push(defer);
  }
  
  $.when.apply(window, defers).done(function(){
      // Do Something
  });
  </code></pre>
  
  <p>Is there a more elegant solution than the code in my example?</p>