複数のPromiseを並列実行し全て完了したら結果を返す
const [user, posts, comments] = await Promise.all([
fetchUser(id),
fetchPosts(id),
fetchComments(id),
]);
// 1つでも失敗すると全体がreject
try {
await Promise.all([ok, fail, ok]);
} catch (e) { console.error(e); }1つでも失敗すると全体がrejectされる。失敗を個別に扱いたい場合はPromise.allSettledを使う。