Q16: How does async/await work under the hood?
async/await is syntactic sugar over Promises and Generators. An async function always returns a Promise. When await is encountered, function execution yields pause control back to the Event Loop until the awaited Promise settles.
Key Takeaways
asyncfunctions wrap return values in resolved Promises.awaitpauses async function execution without blocking the main event thread.
Knowledge Check
What does an async function return if it explicitly returns a plain primitive value 42?