Simply use the on JS Object

Many feel that their memory when they are in a recession, and obviously I was pretty young, after I left school, learning and memory in less time yet? Still have to take notes ah. . . Something all right to come back and see. . .

= 1. Define new new Object obj var ();
2. obj determines whether there is a key-value (attribute)
var = the keyName "XXX";
? Obj.hasOwnProperty (the keyName) = (? To true to false)
3. whether obj or whether a key (attribute) can enumerate
obj.propertyIsEnumerable () = (false to true?);?
obj.propertyIsEnumerable (keyName) = (false to true?);?
obj.propertyIsEnumerable (keyName), can also be used to determine key values (attributes) of the object exists
4. delete the key (attributes) delete obj [keyName];

to operate with obj object:
1. define the obj: Object.create (obj), note that the Object.create (obj )! Object new new = ();
2. See obj: Object.assign (obj)
3. obj acquired key values (attributes) set: Object.getOwnPropertyNames (obj)
4. See obj has number keys Object.keys (obj) .length or Object.getOwnPropertyNames (obj) .length

5. Object.defineProperty: defineProperty point on the content may be a reference .

Guess you like

Origin www.cnblogs.com/2625664742-chanyk/p/12486903.html