Created
May 13, 2021 19:47
-
-
Save AaronGoldsmith1/e617a93ce8e7352ac0757f1bf1a45fe9 to your computer and use it in GitHub Desktop.
Promise.all() 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
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