"NaN" is a javascript sentinel object of type Number.The most important remember here is if a varible value is not adequately represented as Number results in NaN.In short, "numeric results that cannot be adequately represented" is NaN.
For Exmaple,
- 0 divided by 0 can not be represented in number so it is NaN.But it's result is Number for sure.That is the reason alert 0/0 gives NaN while typeof gives Number.
- same with the case with the b divided by b, where bis Infinity.
- Below Jsfiddle shows the javascript code for it,