Promise.all

김형민·2021년 6월 1일
0

async function main() {
const a = await f1();
const b = await f2();
const c = await f3(b);
const d = await f4(a, c);
return d;
}

Promise.all을 이용해 main의 실행속도를 향상시켜보자!

const main = async () => {
const [a, b, c, d] = await Promise.all([
Promise1(),
Promise2(),
Promise3(await Promise2()),
Promise4(await Promise1(), Promise3()),
]);
}

profile
항해 중인 개발자

0개의 댓글