I need some help with accessing the property value of an object that is nested within another object.
I have this code:
var userStats = {
'Jacob': {
visits: 1
},
'Owen': {
visits: 2
},
'James': {
visits: 3,
},
'Ann': {
visits: 4
}
};
What I want to do is access the value of the visits.
I have tried:
for(var firstName in customerData){
console.log(firstName.visits);
}
But it is not working. It outputs 'undefined'.
Any help is greatly appreciated.