1. Three ways to create objects
1. Literally create objects
2. New keyword + constructor to create an object
3. Object.create() creates an object
2. Two ways to view object properties and change object values
1. In the form of: obj.key=value
2. In the form of: obj[key]=value
3. Delete object properties
1、delete obj.key
2、delete obj[key]
Four, four ways that can be used as object attribute names
1. Identifier
2. String
3. Calculated properties
4. Symbol
5. Combine multiple object methods
1、Object.assign
obj=Object.assign(obj1,obj2...)
2. Extension operator
obj={...obj1,...obj2}
6. Four ways to enumerate object properties
1、for/in for/of
2、Object.keys()
3、Object.getOwnPropertyNames()
4、Object.getOwnPropertySymbols()
5、Reflect.OwnKeys()
7. Three ways to test whether an attribute exists
1、key in obj ==》true or false
2、obj.hasOwnProperty(key) ==》true or false
3、obj.propertyIsEnumerable(key) ==》true or false
8. Obtaining prevention and setting methods of object properties (accessor properties, inheritable)
1. Obtaining method: setter
2. Setting method: getter
9. Add writability, enumeration and configurability to object properties
Object.defineProperty(target.key,{
value:"",
writable:true,
enumerable:true,
configurable:true
})
10. Two syntactic sugars about objects
1. The attribute key is the same as the attribute value, abbreviated as one,
like:
Shorthand:
2. Method shorthand in the object
like:
Shorthand: