isNaN(123);//false isNaN('123');//false
NaN refers to Not-a-Number, isNaN(), if it is NaN, it returns true. Then 123 is not NaN, of course it returns false. '123' is type converted to Number type 123, so it returns false.
NaN
isNaN()
true
123
false
'123
This is to judge whether it is NaNthis special number....
NaN
refers to Not-a-Number,isNaN()
, if it isNaN
, it returnstrue
.Then
123
is notNaN
, of course it returnsfalse
.'123
' is type converted to Number type123
, so it returnsfalse
.This is to judge whether it is
NaN
this special number....