Skip to content
JavaScript·Beginner·Conceptual·1 min read

Why is typeof NaN 'number' and not something like 'NaN'?

Short interview answer

NaN is defined as a special value within the IEEE 754 number type, representing an invalid numeric result — it is still fundamentally of the number type, just one specific value within it that fails to equal itself.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Equality and type coercion

Related questions