async function wait(ms) { return new Promise((res, rej) => { setTimeout(() => { res(new Date().valueOf()); }, ms); }); } // 并行 // (async () => { // const p0 = wait(1000); // const p1 = wait(1000); // const c = await p0; // const d = await p1; // console.log(c, d); // })(); // 同步等待 (async () => { const c = await wait(1000); const d = await wait(1000); console.log(c, d); })();