Open ddqweqrqwrwqr opened 10 months ago
console.log("Hello World!")
function sleep(time) { return new Promise(resolve =>{ setTimeout(resolve, time) }) }
async function run() { console.log("Hello World!2") await sleep(1000) console.log("Hello World!3") }
run()
results Hello World! Hello World!1
the third console.log cannot run! help me
run
await
run().then(() => process.exit());
console.log("Hello World!")
function sleep(time) { return new Promise(resolve =>{ setTimeout(resolve, time) }) }
async function run() { console.log("Hello World!2") await sleep(1000) console.log("Hello World!3") }
run()
results Hello World! Hello World!1
the third console.log cannot run! help me