AS3 文档指出,如果您将字符串传递给parseInt
that is not a number ,它将返回NaN
。但是,当我尝试与NaN
编译器进行比较时,会出现以下错误:
Warning: 1098: Illogical comparison with NaN. This statement always evaluates to false.
该声明实际上是正确的。与 NaN 比较总是会返回false
。如何与 NaN 进行比较以检测解析的内容是否为 NaN?
if( parseInt("test") == NaN )
{
// do something (never gets here)
}