Your product could be here, in front of thousands of JavaScript developers. Sponsor this spot →
JavaScript Quiz

JavaScript Promises and Async/Await Quiz

JavaScript runs one thing at a time. Synchronous code runs first, then promise callbacks (microtasks), then timers and other tasks. Knowing this order lets you predict exactly what async code will log.

These questions cover promises, async/await, Promise.all, setTimeout and the event loop.

Promises & Async questions

  1. Why does an arrow function in setTimeout keep this?
  2. Why does a Promise run before setTimeout 0?
  3. What does an async function return in JavaScript?
  4. What runs first after await in JavaScript?
  5. Is the Promise constructor callback synchronous?
  6. What happens when one promise in Promise.all rejects?
  7. What is the difference between Promise.all and Promise.allSettled?
  8. Why does a .then() without return pass undefined?
  9. What happens if you call resolve twice in a Promise?
  10. In what order do setTimeout callbacks run?
  11. What is queueMicrotask in JavaScript?
  12. Why doesn't try/catch catch an error from an async function?

More topics