8. 10 code does not work


#1

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 property in nyc){
console.log(property);
}


#2

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 property in nyc){
console.log([property]);<---you forgot to put [ property] in square brackets..
}


#3

still doesnt work :(((((((((((((((((((((((


#4

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 property in nyc){
console.log(nyc[property]);<-----add the "nyc[property]"
}

The my first reply allows you to print our the property , while the one prints out the value. Notice the difference.


#5

thanks it works now !!!!