Promise all resolvation
<p>I am playing with promises and found about <code>Promise.all()</code> if i understood correctly it resolves after all promises in arguments were resolved. I tried little code</p>

<pre><code>var x = ["one", "two"];
var g = 1000;

function take(element, sec) {
  return new Promise(function(res, rej) {
    setTimeout(function() {
      res(element)
    }, sec);
  })
}

Promise.all(x.map(y =&gt; {
  take(y, g);
  g+=1000;
})).then(f =&gt; {
  alert('done : ' + f);
})
</code></pre>

<p>but it Promise.all resolved instantly , is there any bug in this little piece of code or my understanding of it is bad?</p>