Skip to main content
JavaScript Interview Questions Predict Output P0 Medium

Promise.all result order vs completion

Assume a single browser task. Predict the logs and the order of all results.

Official Reference

Code Snippet

const slow = new Promise(resolve => setTimeout(() => {
  console.log("slow finished");
  resolve("S");
}, 0));
const fast = Promise.resolve().then(() => {
  console.log("fast finished");
  return "F";
});
Promise.all([slow, fast, 4]).then(items => console.log(items.join(" ")));

Expected Output & Explanation

fast finished
slow finished
S F 4

The fast reaction is a microtask and runs before the timer. all accepts non-promises and places every fulfillment value in input order, not completion order.

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.