Getting IN-timate


I don't have errors but I need someone to break it down for me. The exercise intorduces the for/in loop and states that the property value can be any placeholder name. Does that mean I can use any property name in the for/in loop present in the object and still have it print out all of the properties?

var nyc = {
    fullName: "New York City",
    mayor: "Bill de Blasio",
    population: 8000000,
    boroughs: 5

for(var fullName in nyc){


For the sake of readability, use generic key or index variables in your loop that do not appear as actual key names in your objects.


for (var key in nyc) {


This will cycle through all the properties of nyc (in any order) and at each iteration, one of the property names will be cached in key.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.