MediumType Coercion💻 Output Question

Truthy and falsy — empty array and object are truthy

💡

Hint

Empty arrays [] and objects {} are TRUTHY. This surprises many developers.

What does this output?

console.log(Boolean(0));
console.log(Boolean(''));
console.log(Boolean(null));
console.log(Boolean([]));
console.log(Boolean({}));

Correct Output

false
false
false
true
true

Why this output?

Explanation: Falsy: 0, "", null, undefined, NaN, false. Everything else is truthy — including empty arrays and objects.

Key Insight: Empty arrays [] and objects {} are TRUTHY. This surprises many developers.

More Type Coercion Output Questions

EasyPlus operator: string concat vs numeric addMediumLoose equality edge cases with nullEasytypeof for common valuesMediumUnary plus converts to number

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz