Object objects are of little use to themselves, but they should be understood before other classes are known. Because object objects in ECMAScript are similar to Java.lang.Object in Java, all objects in the ECMAScript are inherited by this object, and all properties and methods in object objects appear in other objects, so the Ob is understood Ject objects, you can better understand other objects.
Object objects have the following properties:
-
Constructor
-
A reference (pointer) to the function that created the object. For object objects, the pointer points to the original object () function.
-
Prototype
-
a reference to the object's prototype of the object. For all objects, it returns an instance of object by default.
Object objects also have several methods:
-
hasOwnProperty (property)
-
Determines whether an object has a specific property. This property must be specified with a string. (For example, O.hasownproperty ("name"))
-
isPrototypeOf (object)
-
Determines whether the object is a prototype of another object.
-
propertyIsEnumerable
-
Determines whether a given property can be enumerated with a for...in statement.
-
ToString ()
-
Returns the original string representation of the object. For object objects, ECMA-262 does not define this value, so different ECMAScript implementations have different values.
-
ValueOf ()
-
returns the original value that best fits the object. For many objects, the method returns the same value as the return value of ToString ().
Note: Each of the properties and methods listed above will be overwritten by other objects.
JavaScript Object Objects