we kown for..in loop does not care if the property is the attribute of object’s prototype-chain .so it will output the attribute all.
and let us do a test
var o={};
for(var i in o){
console.log(o[i]);// output none
}
a object(created by this way:{}) is from Object,
but when we run the code,the Object prototype-chain method (like toString )is not outputed
why the method (toString) in prototype-chain of Object is not outputed ????
toStringis not enumerable:You can create your own non-enumerable properties like so:
Technically you can omit the
enumerable: false, since that is the default.This is indicated in the spec in the blanket section 15 clause: