title: Wht is the difference between Q.all() and Promise.prototype.all() methods?
body: <p>I'm trying to understand how promises work, so general idea is quite clear, but currently I'm stuck with <code>all()</code> method. I know, it used to make a promise for an array of other promises, which will be resolved when all promises from the array will resolved or will be rejected when any of the promises from the array will rejected. Here is my code snippet:</p>
  
  <pre><code>var qu = require('q');
  var proArr = [];
  
  for(var i = 0; i &lt; 4; i++) {
      var tmpDef = qu.defer();
  
      (function(index, tmpDef) {
          setTimeout(function() {
              console.log('Timeout ' + index + ' has triggered!');
              tmpDef.resolve();
          }, (i + 1) * 1000);
          proArr.push(tmpDef.promise);
      })(i, tmpDef);
  }
  
  qu.all(proArr).then(function() { 
      console.log('All timeouts has passed with Q.all()!');
      return 'some result';
  });
  qu.defer().promise.all(proArr).then(function() { 
      console.log('All timeouts has passed with promise.all()!');
      return 'some result';
  });
  </code></pre>
  
  <p>For this snippet a promise, which returned by <code>qu.all()</code> method will be resolved when all timeouts will be triggered, but a promise, which returned by <code>qu.defer().promise.all()</code> method will stay in pending state even if all timeouts will be triggered. So what the method <code>Promise.prototype.all()</code> have to be used for? And how it differs from <code>Q.all()</code> method?</p>
  
  <p>Also I've looked in Q library sources, and here is a code for <code>Promise.prototype.all()</code> method:</p>
  
  <pre><code>Promise.prototype.all = function () {
      return all(this);
  };
  </code></pre>
  
  <p>As I can understand, this method calls <code>Q.all()</code> with an instance of current promise as an argument, but why? Don't the method <code>Q.all()</code> have to accept an array of promises? So I'll be very appreciated for clarification of all this moments.</p>