isNaN error?


#1

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


#2

https://duckduckgo.com/?q=NaN+site%3Adeveloper.mozilla.org

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,

42

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'

#3

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


#4

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