Is async/await syntactic sugar over promises in JavaScript?
Yes. async functions return promises. await unwraps promises. try/catch with await is equivalent to .catch with .then. You can mix await with Promise.all.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How async/await Works Behind the Scenes in JavaScript
async functions return promises. await pauses the function and yields control to the caller. The rest of the function runs as a microtask when the awaited promise settles. await unwraps the promise or throws the rejection reason.
No. await pauses the async function and yields control to the caller. The caller continues running synchronous code. The rest of the async function runs as a microtask when the awaited promise settles.
Code before await runs synchronously. await pauses and schedules the rest as a microtask. Code after the foo() call runs next (sync). Then the rest of foo runs (microtask). So: 1, 3, 2.
Still have questions?
Browse all our FAQs or reach out to our support team
