By Guest

Unnamed Paste

Auto Detect 315 Bytes 46 3 months ago
async function sleep(time) { console.log(`Waiting for ${time}ms.`) let promise = new Promise((resolve, reject) => { setTimeout(() => resolve("Done!"), time) }); return await promise; } function main() { console.log("Hello, world!") sleep(1000); console.log("Finished.") } main();