//遍历排除继承属性
var o = {x:1,y:2,z:3};
for(p in o){
if(!o.hasOwnProperty(p)) continue;
xxxxxx;执行方法
}
//排除是方法的属性
for(p in o){
if(typeof o[p] === "function") continue;
xxx;
}
//遍历排除继承属性
var o = {x:1,y:2,z:3};
for(p in o){
if(!o.hasOwnProperty(p)) continue;
xxxxxx;执行方法
}
//排除是方法的属性
for(p in o){
if(typeof o[p] === "function") continue;
xxx;
}
转载于:https://my.oschina.net/nisir/blog/1377211