1. Object Creation Method:
(1) It is created through the new operator, followed by a constructor name.
Var object = new Object ();
When a constructor calls a function directly, it usually does not return a value. It only initializes the object passed in by the this value. However, when used with new, an object value is returned as the value of the new expression.
(2) direct object quantity
The object quantity is composed of the attribute description list, which is included in braces. The attribute description is separated by commas. Each attribute description of an object's direct quantity is composed of a colon and a property value. The property value can be of any type or function.
Var object = {a: 1, B: 'A', c: function (){}}
2. Set and query object attributes
(1) object. p through the vertex Operator
(2) object ['P']
Method 2 attributes are represented by strings to facilitate dynamic access to Object Attributes
3. enumerate Object Attributes
For (p in object ){
// Do something
}
P is an object attribute. In this method, only user-defined attributes can be listed, and some predefined attributes and methods cannot be listed, such as constructor.
4. The undefined attribute of the access object is returned;
5. Object Methods
The method definition and access of an object are similar to object properties, but the object method is a function. The object that calls a method through this inside the Method
6. Prototype object of the object
(1) Each object has an original object that inherits all attributes of its prototype object. property inheritance only occurs when the attribute value is read;
(2) The prototype of an object is defined by the constructor that creates and initializes the object;
(3) Each function (constructor) has a prototype attribute that references the prototype object of the function.