Skip to main content
JavaScript Interview Questions Predict Output P0 Hard

Coercion, NaN and signed zero

Predict both lines. Explain why the equality operations disagree.

Official Reference

Code Snippet

console.log("0" == false, "0" === false, null == undefined);
console.log(Object.is(NaN, NaN), NaN === NaN, Object.is(0, -0), 0 === -0);

Expected Output & Explanation

true false true
true false false true

Loose equality converts false to numeric zero in the first comparison and has a specific null/undefined rule. Strict equality does not coerce. Object.is treats NaN as equal to itself and distinguishes the signs of zero.

Module Context & References

JavaScript · Language output drills Trace closures, receivers, prototypes, coercion and array edge cases
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.