MediumType Coercion💻 Output Question

Loose equality edge cases with null

💡

Hint

null is only == to null and undefined — NOT to 0, false, or "".

What does this output?

console.log(0 == false);
console.log('' == false);
console.log(null == undefined);
console.log(null == false);

Correct Output

true
true
true
false

Why this output?

Explanation: 0==false: both→0. ""==false: both→0. null==undefined: spec rule. null==false: null only equals null or undefined.

Key Insight: null is only == to null and undefined — NOT to 0, false, or "".

More Type Coercion Output Questions

EasyPlus operator: string concat vs numeric addEasytypeof for common valuesMediumTruthy and falsy — empty array and object are truthyMediumUnary plus converts to number

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz