hasOwnProperty Method
Returns a Boolean value indicating whether an object has a property with the specified name.
function hasOwnProperty(proName : String) : Boolean
Arguments
- proName
Required. String value of a property name.
Remarks
The hasOwnProperty method returns true if the object has a property of the specified name, false if it does not. This method does not check if the property exists in the object's prototype chain; the property must be a member of the object itself.
Example
In the following example, all String objects share a common split method.
var s = new String("JScript");
print (s.hasOwnProperty("split"));
print (String.prototype.hasOwnProperty("split"));
The output of this program is:
false
true
Requirements
Applies To:
See Also
Reference
Change History
Date |
History |
Reason |
---|---|---|
July 2009 |
Modified example. |
Content bug fix. |
March 2009 |
Modified example. |
Content bug fix. |