Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


hasOwnProperty Method


Applies To: Object ObjectRequirements
Version 5.5Returns a Boolean value indicating whether an object has a property with the specified name.
object.hasOwnProperty(proName)
Arguments
object
Required. Instance of an object.
proName
Required. String value of a property name.
Remarks
The hasOwnProperty method returns true if 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. The following code will print false and true.
var s = new String("JScript");
print(s.hasOwnProperty("split"));
print(String.prototype.hasOwnProperty("split"));

Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.