Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AaronGoldsmith1/e617a93ce8e7352ac0757f1bf1a45fe9 to your computer and use it in GitHub Desktop.
Save AaronGoldsmith1/e617a93ce8e7352ac0757f1bf1a45fe9 to your computer and use it in GitHub Desktop.
Promise.all() Example
function loop1(){
return new Promise((resolve, reject) => {
for (var i = 1; i <= 100; i++) {
console.log('loop1 =>', i);
}
resolve();
})
}
function loop2(){
return new Promise((resolve, reject) => {
for (var i = 1; i <= 100; i++) {
console.log('loop2 =>', i);
}
resolve();
});
}
Promise.all([loop1(), loop2()]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment