List ALL the Properties!


Hello. I dont get any error, but just want something in this exercise explained to me: How does JavaScript know that "x" refers to the properties values? Haven't declared " var x" anywhere?

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 x in nyc) {


When you say for var x in nyc It is as if you are referring to the property values in the loop through the instant variable x.


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