Enumeration
File Location
javascript-library
└── 0-PreWork
└── 1-Fundamentals
└── 11-Objects
01-properties.js
02-enumeration.js <----You will be working in this file.What is Enumeration?
Enumerating properties
var country = {
capital : "Tegucigalpa",
name: "Honduras",
mainExport: "Bananas"
};
//Since everything is enumerable, our for in loop should be able to find everything.
for (var property in country){
console.log(property + ' : ' + country[property]);
}
/*
capital : Tegucigalpa
name : Honduras
mainExport : Bananas
*/Practice
Challenge
Last updated