js 用 hasOwnProperty() 判定属性是来自该对象成员,还是原型链
var People=function(){
this.name='liujinyu';
};
People.prototype={
age:24,
add:function(){},
}
var p1 = new People();
for(n in p1){
document.write(n+":"+p1[n]+" / "+p1.hasOwnProperty(n));
document.write("<br />");
}
//name true
//age false
//add false