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

 
输出:
//输出的是属性
 
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]);
    }
 
输出:
//输出了属性的内容
posted on 2015-09-29 15:00  不想做菜鸟的学渣喵  阅读(269)  评论(0编辑  收藏  举报