suppose there is a group leader like this
var qq = [
{
"info": {"event": 123},
"odds":
[
{"o": ["test","123",],
"oName": " "
},
{"o": ["qq","ee",],
"oName": ""
},
],
"main": true,
},
{
"info": {"event": 323},
"odds": [
{"o": ["jk","234"] ,
"oName": ""
}
],
"main": true,
}
];
I want to print out every oName
qq.forEach(function(item,i){
console.log(item.odds.oName)
//undefined
console.log(item.odds[i].oName)
//" "
//"TypeError: Cannot read property "oName" of undefined
return
});
Why is it impossible to print out all the oName? How to solve it?