var array=[ { "index_id": 119, "area_id": "18335623", "name": "满意度", "value": "100" }, { "index_id": 119, "area_id": "18335624", "name": "满意度", "value": "20" }, { "index_id": 119, "area_id": "18335625", "name": "满意度", "value": "80" }];
取最大值:Math.max.apply(Math, array.map(function(o) {return o.value}))
取最小值:Math.min.apply(Math, array.map(function(o) {return o.value}))
说明:array是我们上面定义的数组,o.value就是要比较的字段。
本文来自互联网:https://blog.csdn.net/cargelzhong/article/details/81458610
原文地址:https://www.cnblogs.com/subendong/p/11637137.html
时间: 2024-10-13 12:25:31