instanceof operator

object instanceof classConstructor

Tests whether object is an instance of classConstructor or a subclass of classConstructor. The instanceof operator does not convert primitive types to wrapper objects. For example, the following code returns true:

new String("Hello") instanceof String;

Whereas the following code returns false:

"Hello" instanceof String;

Operands

object : Object - An ActionScript object.

classConstructor : Function - A reference to an ActionScript constructor function, such as String or Date.

Returns

Boolean - If object is an instance of or a subclass of classConstructor, instanceof returns true, otherwise it returns false. Also, _global instanceof Object returns false.

See also

typeof operator


Flash CS3