Skip to main content
JavaScript Interview Questions Predict Output P0 Hard

Async return vs Promise.resolve identity

Predict all booleans. Compare object identity, not fulfillment values.

Official Reference

Code Snippet

const source = Promise.resolve("ok");
function direct() { return source; }
async function adopted() { return direct(); }
async function awaited() { return await direct(); }
console.log(direct() === source, Promise.resolve(source) === source);
console.log(adopted() === source, awaited() === source);
console.log(adopted() === awaited(), adopted() === adopted());

Expected Output & Explanation

true true
false false
false false

The ordinary function returns the exact instance. Promise.resolve reuses this native promise with the same constructor. Every async-function call returns a fresh promise, even when it adopts the same outcome.

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.