Created
January 11, 2017 05:43
-
-
Save doron2402/8b567edb0bd7591d22567d9dc1fe6885 to your computer and use it in GitHub Desktop.
Promise.all run promise in parallel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all | |
var p1 = Promise.resolve(3); | |
var p2 = 1337; | |
var p3 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 100, "foo"); | |
}); | |
Promise.all([p1, p2, p3]).then(values => { | |
console.log(values); // [3, 1337, "foo"] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment