AS3 Version of isNaN


#1

In as2:
trace( isNaN(“Tree”) );
// returns true

trace( isNaN(56) );
// returns false

In AS3:
Compile Error:
Scene 1, Layer ‘Layer 1’, Frame 1, Line 1 1067: Implicit coercion of a value of type String to an unrelated type Number.

What is the the AS3 version of isNaN ?


#2

AS3 is more fussy about data types. Either turn compiler strict mode off or attempt to convert to a Number first:

isNaN(Number(“tree”))

I think that should work, though it’s been years since I’ve used AS.


#3

Case closed ! You are correct The one and only Canadian !


#4

@TheCanadian continues to surprise me with things like despite not having used it in so long :proud:


#5

I cheated and looked at the docs :run_in_fear:


#6

I dunno if looking at the docs is really cheating. That’s sort of why they exist.


#7

I believe true codesman would just will the correct code directly onto the screen.