Skip to main content
JavaScript Interview Questions Predict Output P1 Hard

Thenable adoption vs queueMicrotask

Assume modern browser scheduling. Which reaction is queued first?

Official Reference

Code Snippet

const thenable = {
  then(resolve) {
    console.log("adopt");
    resolve(7);
  }
};
Promise.resolve(thenable).then(value => console.log(value));
queueMicrotask(() => console.log("microtask"));
console.log("sync");

Expected Output & Explanation

sync
adopt
microtask
7

The thenable’s then method runs in an adoption job. Fulfilling the promise there queues the reaction after the already queued microtask.

Module Context & References

JavaScript · Async output drills Trace microtasks, promise identity, thenables and error recovery
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.