Find the maximum value of an attribute in the object array, and then return the other property values of the item

,.
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.

< hr >

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;
            }
          });

array.reduce((p,v) => p.value < v.value ? v : p).id

you can sort it first (from big to small), and then take the first object

  

Math.max.apply (Math, array.map (function (item) {return item.id})

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39ab6-e700.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39ab6-e700.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?