Welcome to JS Bin
Load cached copy from
10
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
  <meta charset="utf-8">
5
  <title>JS Bin</title>
6
</head>
7
<body>
8
9
</body>
10
</html>
14
 
1
var guid = 0;
2
function run() {
3
  guid++;
4
  var id = guid;
5
  return new Promise(resolve => {
6
    setTimeout(function () {
7
      console.log(id);
8
      resolve(id);
9
    }, (Math.random() * 1.5 | 0) * 1000);
10
  });
11
}
12
13
var promises = Array.from({ length: 10 }, run);
14
Promise.all(promises).then(console.log);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x