- for in 获取自身及继承对象的所有可枚举属性
- Object.keys() 只能获取自身的可枚举属性,不能获取继承来的属性值
- Object.getOwnPropertyNames() 获取对象的可枚举和不可枚举属性
var o = {};
o.name = "property";
Object.prototype.age = 20;
for(var key in o){
console.log(key);//
}
var o = {};
o.name = "property";
Object.prototype.age = 20;
for(var key in o){
console.log(key);//
}