Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Set Value if variable is Not NaN. Reply To: Set Value if variable is Not NaN.

#180909
Chromawoods
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.