title: What is typeof(NaN) in Javascript?
body: <p>I just happen to stumble upon a code which checks the <code>typeof</code> of a varable passed to it just like this.</p>
  
  <pre><code>function myNaN(b){
  
    if(typeof(b) == 'number'){
      // execute some code
    }
  
  }
  </code></pre>
  
  <p>Whenever I call this function it works fine and passes the if condition if number is being passed.</p>
  
  <p>However when I pass a <code>NaN</code> (which is the output of some other function) to this function the <code>if</code> condition returns true.</p>
  
  <p>My question is it correct that <code>typeof(NaN) == 'number'</code> ? If so, why? Isn't it confusing?</p>
  
  <p>Just try running <code>console.log(typeof(NaN));</code> in browser console to see what I mean.</p>