Created
February 8, 2017 15:51
-
-
Save lcfd/8a5bdd0c8301a5ac3638e3a0ca786de3 to your computer and use it in GitHub Desktop.
Es6 and Promise example
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
var pr1 = new Promise((resolve, reject) => { | |
setTimeout(function () { | |
resolve([1,3,4,46,234,33,4,536]); | |
}, 500); | |
}) | |
var pr2 = new Promise((resolve, reject) => { | |
setTimeout(function () { | |
resolve(20); | |
}, 1000); | |
}) | |
let printValues = (values) => { | |
console.log('Values: ', values); | |
} | |
Promise | |
.all([pr1, pr2]) | |
.then(printValues) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment