var nyc = {
    fullName: "New York City",
    mayor: "Bill de Blasio",
    population: 8000000,
    boroughs: 5
};
for(var i in nyc){
   
    console.log(i);
   
}

 
输出:for-in用法-LMLPHPfor-in用法-LMLPHP
//输出的是属性
 
var nyc = {
    fullName: "New York City",
    mayor: "Bill de Blasio",
    population: 8000000,
    boroughs: 5
};

// write a for-in loop to print the value of nyc's properties
for(var i in nyc){
    console.log(nyc[i]);
    }

 
输出:for-in用法-LMLPHPfor-in用法-LMLPHP
//输出了属性的内容
05-07 15:25