用于对象的循环写法key是变量名 var obj ={ name: "周杰伦", sex: "男", occupation: "歌手" }for(var key in obj){ console.log(key);//获取属性 console.log(obj[key]);//获取属性的值 }