Skip to main content
JavaScript Output Prediction Medium +20 XP

NaN Comparison

What does this log?

JavaScriptRead-only
console.log(NaN === NaN);
console.log(typeof NaN);

What is the output?

Show answer and explanation

Answer: false then number

NaN is not equal to anything, including itself! And typeof NaN is surprisingly 'number'.

Hint: NaN is very unique.

What this challenge tests

Output Prediction in JavaScript: nan, typeof, gotchas.

Related challenges