Now I am not what you call an ActionScript know-it-all. In fact, I learn something nearly everyday about AS3 and Flex. That’s why I love my job. So I ran into an issue where I was using isNaN expecting to get true. Various values were getting passed in but I wasn’t getting consistent results. Why?
Well part of that was that I was passing int(s) as values. I hadn’t initialized the var to anything. I just said var i:int; much like we might define var n:Number; and its initialized value would be the numerical equivalent to null which is NaN.
Little to my knowledge this was occuring:
var n:Number;
trace(isNaN(n)); //true, because the default value of a Number is NaN
var i:int;
trace(isNaN(i)); //false, because int defaults to 0, not NaNCool tip? I’d like to think so. Anywho…
Brgds,
CP
June 27th, 2007 at 8:34 pm
Well, it’s in the specs…