,.
var array=[
{
"id": 52354541,
"name": "",
"value": "55"
},
{
"id": 43563123,
"name": "",
"value": "88"
},
{
"id": 32525763,
"name": "",
"value": "76"
}];
if you are looking for the maximum value, you can directly
Math.max.apply (Math, array.map (function (item) {return item.value}) / / 88
but now I want to modify this code if the return value is not value, but id.
the code I"m using now is, how can I write it better?
let max = 0;
let maxId = "";
res.data.map(item => {
if(item.orgAccumulative > max) {
max = item.orgAccumulative;
maxId = item.id;
}
});