Q1.

Explain the lifecycle of a Promise in terms of:


Q2.

What will this log, and why exactly?

console.log("start");

setTimeout(() => console.log("timeout"), 0);

Promise.resolve()
  .then(() => console.log("promise1"))
  .then(() => console.log("promise2"));

console.log("end");

I’m not looking for just output—walk me through the event loop + microtask queue precisely.


Q3.

What problem does .catch() solve that a second argument to .then() does not?

Example:

promise.then(successHandler, errorHandler);

vs

promise.then(successHandler).catch(errorHandler);

When do they behave differently?


Promises — Control & Composition

Q4.