js- determined whether the object attribute hasOwnProperty ()

 

var obj ={
name:'suan',
sex :'male',
age:150,
height:185,
characeter:true,
_proto_:{
lastName:'susan',
_proto:{
lastSex:'male'
}
}
}
for(var key in obj){
if (obj.hasOwnProperty(key)){
console.log(obj[key])
}
}

Guess you like

Origin www.cnblogs.com/jie-xuan/p/11311333.html