JS获取JSON对象数组某个属性最大值

            var name_value= [{"name":"闵行区","value":20},{"name":"浦东新区","value":30},{"name":"杨浦区","value":10}]
            var list = new Array();
            for(var i in name_value){
            list.push(name_value[i].value);
            }
            list.sort(function(num1,num2){
            return num1-num2;
            })
            var maxcnt= eval(list[list.length-1]);

 

转载于:https://www.cnblogs.com/asiarice/p/7922081.html

你可能感兴趣的:(JS获取JSON对象数组某个属性最大值)