The code copy is as follows:
/*
propertyIsEnumerable() is used to detect whether the property belongs to an object. If it is detected, it returns true, otherwise it returns false.
1. This attribute must belong to the instance and not to the prototype.
2. This property must be enumerable, that is, a custom property that can be looped out through for..in.
As long as the above two requirements are met, true will be returned;
*/
function MyObject() {
this.name = "I am an instance's property";
}
var obj = new MyObject();
alert(obj.propertyIsEnumerable("name"));//true
MyObject.prototype.say = "I am the property of the prototype";
alert(obj.propertyIsEnumerable("say")); //false
for (var i in obj) {
alert(i);//name,age
}