My goal is to obtain the highest value from the scores
object.
I have a global object called "implementations":
[
{
"id": 5,
"project": 'name project',
"scores": [
{
"id": 7,
"user_id": 30,
"implementation_id": 5,
"score": "12.00",
"comment": "C'est de la merde, ça vient d’Anthony."
},
{
"id": 10,
"user_id": 31,
"implementation_id": 5,
"score": "15.00",
"comment": "Super"
}
]
},
{
"id": 6,
"project": 'name project',
"scores": [
{
"id": 8,
"user_id": 30,
"implementation_id": 6,
"score": "20.00",
"comment": "Super!"
},
{
"id": 11,
"user_id": 31,
"implementation_id": 6,
"score": "12.00",
"comment": "Super"
},
{
"id": 15,
"user_id": 36,
"implementation_id": 6,
"score": "10.00",
"comment": "Super"
}
]
}
]
As illustrated in the above object, there are 2 scores in object 1, and 3 scores in object 2.
My aim is to retrieve the maximum value of both. If we introduce a third object with 5 scores, I would like to extract 5 as the result.
Is there a way to achieve this using a javascript function?
Your assistance is much appreciated.