遍历对象打印对象中的值
var obj ={
x:100,
y:200,
z:300
}
for(key in obj){
if(obj.hasOwnProperty(key)){
console.log(key,obj[key])
}
if(key == 'x'){
console.log(key,obj[key])
}
}
var obj ={
x:100,
y:200,
z:300
}
for(key in obj){
if(obj.hasOwnProperty(key)){
console.log(key,obj[key])
}
if(key == 'x'){
console.log(key,obj[key])
}
}