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()),
]);
}