Table of Contents

instanceof Operator Flash 6

determines whether an object is an instance of a given class
object instanceof classConstructor

Operands

object

Any object.

classConstructor

A reference to any class's constructor function.

Returns

The Boolean true if object is an instance of classConstructor; otherwise, it returns false.

Usage

The instanceof operator does not take parentheses (it is an operator, not a function).

Example

var now = new Date();
trace(now instanceof Date);  // Displays: true

See Also

typeof; the Constructor subheading for the Date class; Chapter 12; Section 5.12.7


Table of Contents