How would I loop through each of the value:
properties in the object below? My attempt in the console.log
below obviously does not work, but that is what I was trying to accomplish. console.log(key)
would output "A1" "A2"
, but I can not figure out how to loop through and retrieve the names or values of deeper leveled properties.
var object = {
A1: {
B1: {
C1: "A"
},
B2: {
C1: "B"
},
B3: {
C1: "C"
},
},
A2: {
B4: {
C1: "D"
},
B5: {
C1: "E"
},
B6: {
C1: "F"
}
}
};
for (var key in object) {
console.log(object[key][key].value);
}