|
March 10, 2001 Checking for a Certain Property Tips: March 2001
Yehuda Shiran, Ph.D.
|
|
Use the hasOwnProperty() method to find out if an object has a certain property you are interested in. The hasOwnProperty() is a method of the Object object, and thus all objects inherit it (all objects are subclasses of the Object object). The following code checks if the object Ken of the Employee subclass has a manager. Try it, it should give true:
People who read this tip also read these tips: Look for similar tips by subject: |