Home › Forums › JavaScript › Set Value if variable is Not NaN. › Reply To: Set Value if variable is Not NaN.
August 28, 2014 at 3:50 am
#180909
Participant
checked it via if (sum!== ‘NaN’)
'NaN'
is a string, NaN
is a number if you check it using typeof
:/. Also, NaN === NaN
turns out to be false
which is confusing and f*cked up but we can use isNaN()
to avoid that.
However, I don’t think I would have solved it that way. Assigning NaN to a variable seems weird I think.