+ 3

What is the meaning of NaN??

8th Apr 2018, 6:52 AM
Dev Dutt
Dev Dutt - avatar
3 Antworten
+ 11
NaN means Not a Number. However it is necessarily not a char or bool or something else. Thats only the case with parseInt function. NaN is a built in object which turns up if you did something that should not be a valid no. Eg. 0/0 "hello"-5 parseInt("hello") undefined+1 Btw, NaN belongs to the primitive type number.
8th Apr 2018, 3:46 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 8
"Not a Number" It could be a char or a boolean or something else! Examples: alert(parseInt("A string")); // alerts NaN alert(parseInt(true)); // alerts NaN
8th Apr 2018, 6:55 AM
777
777 - avatar