JSON object structure:
{
"critiquesAvg": 4.75: ,
"critiques":[
{
'author': 'John Does',
'comment': "I like it",
'stars' : 5
},
{
'author': 'Jacob Works',
'comment': "I like it too",
'stars' : 4.5
}
]
}
I am seeking assistance in dynamically calculating the value of critiquesAvg
by averaging the stars
property from the critiques array.
EDIT: Upon further examination, I encountered a different challenge:
var dealers = [{
"id", 1874
"critiquesAvg": 4.75 ,
"critiques":[
{
'author': 'John Does',
'comment': "I like it",
'stars' : 5
},
{
'author': 'Jacob Works',
'comment': "I like it too",
'stars' : 4.5
}
]
},
{
"id": 1345,
"critiquesAvg": 5 ,
"critiques":[
{
'author': 'John Does',
'comment': "I like it",
'stars' : 5
},
{
'author': 'Jacob Works',
'comment': "I like it too",
'stars' : 5
}
]
}
];
In this scenario, I require assistance in dynamically computing the values of the critiquesAvg
property based on the average critiques for each dealer's data entry.