Why is isNaN(null) == false in JS?
<p>This code in JS gives me a popup saying "i think null is a number", which I find slightly disturbing. What am I missing?</p>

<pre><code>if (isNaN(null)) {
  alert("null is not a number");
} else {
  alert("i think null is a number");
}
</code></pre>

<p>I'm using Firefox 3. Is that a browser bug?</p>

<p>Other tests:</p>

<pre><code>null == NaN; // false
isNaN("text"); // true
NaN == "text" // false
</code></pre>

<p>So, the problem seems not to be an exact comparison with NaN?</p>

<p><i><b>Edit:</b> Now the question has been answered, I have cleaned up my post to have a better version for the archive. However, this renders some comments and even some answers a little incomprehensible. Don't blame their authors. Among the things I changed was:</p>

<ul>
<li>Removed a note saying that I had screwed up the headline in the first place by reverting its meaning</li>
<li>Earlier answers showed that I didn't state clearly enough why I thought the behaviour was weird, so I added the examples that check a string and do a manual comparison.
</i></li>
</ul>
