Object hasOwnProperty()
syntax: |
object.hasOwnProperty(propertyName) |
where: |
property - a string with the name of the property about which to query.
|
return: |
boolean - indicating whether or not the current object has a property of the specified name.
|
description: |
This method determines if the object has a property with the name propertyName. To return true, the property must be an instance property created for this instance of an object and may not be an inheritable or prototype property. This is almost the same as testing defined(object[propertyName]), except that undefined values are different from non-existent values, and the internal _hasProperty() method of the object may be called.
|
example: |
function Atest() { this.name = ""; } // Test
Atest.prototype.city = "Fort Worth";
var t = new Atest();
Screen.writeln(t.city); // Fort Worth
Screen.writeln(t.hasOwnProperty("name")); // true Screen.writeln(t.hasOwnProperty("city")); // false |