The AS3 documentation states that if you pass in a string to parseInt
that is not a number it will return NaN
. However, when I try to compare to NaN
the compiler gives me the following error:
Warning: 1098: Illogical comparison with NaN. This statement always evaluates to false.
The statement is actually true. Comparing to NaN will always return false
. How can I compare to NaN to detect if what was parsed was NaN?
if( parseInt("test") == NaN )
{
// do something (never gets here)
}
Compare with isNaN()
function.