Consider following snippet:
 var nyc = { fullName: "New York City", mayor: "Bill de Blasio", population: 8000000, boroughs: 5 }; 
Which code will print all properties of nyc object?
Explanation
The for..in statement iterates over the enumerable properties of an object, in arbitrary order. For each distinct property, statements can be executed. Example:

var object = { 
   property: 'value',
   property2: 'value' 
}
for (var property in object) {
   // do something here
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes