isNaN error?


Thanks for your teaching program, but it can't cognizes function isNaN


This leads us directly to isNaN() since NaN is not recommended in comparisons. We are given this function as a reprieve.

How do we confirm that something is not a number? We inject it into an equation, that's how.

seven * 6 => NaN

assuming typeof seven is not a number. Were we to write,

var seven = 7;
console.log(seven * 6);

we would get the expected result,


JavaScript always respects definitions. When things are not clear, NaN may result in number related constructs. It's also evident that other issues may exist in our code if this number keeps popping up. Yes, NaN is a Number, even while it is not. There is no other type to match it to so JavaScript saw fit to include it in the set. Try it...

 > typeof NaN
=> 'number'


Thanks for you reply.
I got it. :smile:


Thanks for you reply.
I got it. :smile: