Isnan() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

isNaN()

Availability
Flash Player 5.
Usage
isNaN(expression:Object) : Boolean
Parameters
A Boolean, variable, or other expression to be evaluated.
expression
Returns
A Boolean value.
Description
Function; evaluates the parameter and returns
function is useful for checking whether a mathematical expression evaluates successfully to a
number.
Example
The following code illustrates return values for the
trace( isNaN("Tree") );
// returns true
trace( isNaN(56) );
// returns false
trace( isNaN(Number.POSITIVE_INFINITY) )
// returns false
The following example shows how you can use
expression contains an error:
var dividend:Number;
var divisor:Number;
divisor = 1;
trace( isNaN(dividend/divisor) );
// output: true
// The output is true because the variable dividend is undefined.
// Do not use isNAN() to check for division by 0 because it will return false.
// A positive number divided by 0 equals Infinity (Number.POSITIVE_INFINITY).
// A negative number divided by 0 equals -Infinity (Number.NEGATIVE_INFINITY).
See also
NaN,
Number.NaN
340
Chapter 2: ActionScript Language Reference
ActionScript Language Reference
if the value is
true
function:
isNaN()
to check whether a mathematical
isNAN()
CHAPTER 2
(not a number). This
NaN

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents