Created
March 14, 2022 11:23
-
-
Save yeonwooz/1f8fac5e28c93d7426bac795da6f24c2 to your computer and use it in GitHub Desktop.
promise all
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
async function usePromiseAll() { | |
console.time('a') | |
const res1 = bar(5) | |
const res2 = car(res1) | |
const res = await Promise.all([res1, res2]) | |
console.log(res) | |
console.timeEnd('a') // 2000ms | |
} | |
usePromiseAll() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment