instanceof Operator

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
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



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net