The for/in loop iterates through all the properties that can be enumerated in the object, including its own and inherited properties. The built-in methods of object inheritance cannot be enumerated, and the property methods that are added to the object's own or inherited classes in code are enumerable, but the built-in properties of the object can be enumerated, not necessarily, For example, we can try math's built-in random property (not enumerable) and window's built-in Name property (enumerable).
I. The following summarizes some of the tool functions that enumerate object properties:
1. If O and P have the same name attribute, p overrides o
function Extend (o,p) { for in p) { ifcontinue; Masking Enumerable inherited properties O[prop] = P[prop]; } return o;}
2. If O and P have the same name attribute, p does not affect the O property
function Merge (o,p) { for in p) { ifcontinue; Masking an enumerable inherited property ifcontinue; property with the same name skipped O[prop] = P[prop]; } return o;}
3. If the O attribute does not have the same name attribute in P, delete the attribute in O
function Restrict (o,p) { for (var . o) { ifin P) Delete O[prop]; } return o;}
4. Delete the property with the same name in P in O
function Subtract (o,p) { for (var in p) { delete o[prop]; } return o;}
Enumeration For/in