Finding the max value of an attribute in an array of objects and return the entire object

前端 未结 5 1754
暗喜
暗喜 2021-01-22 12:04

I know a similar question has been asked here: Finding the max value of an attribute in an array of objects, but with that method there is no way to return the entire object con

5条回答
  •  日久生厌
    2021-01-22 12:36

    function getMaxByVal(objArr){
        var max=objArr[0]["value"];
        var indexStore=0;
        var  i=0;
        for(len=objArr.length; i

提交回复
热议问题