In JavaScript, there are four ways to check whether an object o has property x:
1. "x" in o . The in operator can be used to check whether there is x in object o. x can be the object itself (Own Property) or inherited from the prototype object; x can be an enumerable property or a non-enumerable property.
2.ox. You can confirm whether x exists by accessing the ox statement and determining whether the result is undefined. Its scope of action is the same as that of the in operator. Unlike the in operator, if the value of a property x is explicitly declared in object o is undefined, then the "x" in o operation result will be true, and the ox result will be undefined.
3.hasOwnProperty() . The o.hasOwnProperty("x") operation is used to determine whether the o object itself has an x property. The property inherited from the prototype object will not be considered. hasOwnProperty() operation checks both the enumerable property and non-enumerable property.
4.propertyIsEnumerable() . The o.propertyIsEnumerable("x") operation only checks for the enumerable property owned by the o object itself, which is a subset of hasOwnProperty().
Based on the above information, the following figure is summarized as follows: