Async Functions
- Recently, JavaScript added support for async functions
- async functions simplify promises even further
- Allow you to
await
a Promise and write more synchronous code - Remains non-blocking. Always returns a Promise
- Other code can run while async function is
await
ing
async function printSomeStuff() {
await delay(1000);
console.log("Hi");
await delay(1000);
console.log("I'm");
await delay(1000);
console.log("Ryan")
}
10 / 23