var a = Math.sqrt(-1); // Return NaN
var b = parseInt("abrakadabra"); // Return NaN
Some Points to remember
a. Zero divided by Zero results NaN
b. Infinity divided by Inifnity results NaN
c. Any Arithmetic Operation on non-numeric operands that can’t be converted to number type leads to NaN.
How to test whether given variables value is NaN or not?
a. If you perform any arithmetic operation with NaN, then the result is NaN.
Previous Next Home