The Object class in JavaScript is similar to java.lang.Object in Java. | |
The Object class in JavaScript is the base class for all JavaScript classes. | |
All the properties and methods of the Object class are also present in the other classes. | |
The Object class has the following properties: | |
| |
The Object class also has several methods: | |
| |
Determines if a given property exists for the object. | |
The property must be specified as a string. | |
For example, o.hasOwnProperty("name"). | |
| |
Determines if the object is a prototype of another object. | |
| |
Determines if a given property can be enumerated by using the for...in statement. | |
| |
Returns a primitive string representation of the object. | |
| |
Returns the most appropriate primitive value of this object. | |
For many classes, this returns the same value as toString(). | |
Each of the properties and methods listed previously are designed to be overridden by other classes. |