You can determine the class of an object by requesting the name property from its constructor. Since the constructor is a function, you are actually asking a function object for its name. Functions know all about their names. If you get the name of a function that's been used as a constructor, you have effectively gotten its class. Its type is still an object, but its class lets you tell one kind of object from another.
See also: | Determining the object type |
Prev | Home | Next |
constructor property | Up | Content Model |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |