let arr:array = []
// 取最大值:Math.max.apply(Math, arr.map(function(o) {return o.value}))
// 取最小值:Math.min.apply(Math, arr.map(function(o) {return o.value}))
var array=[
{
“index_id”: 111,
“area_id”: “18335623”,
“name”: “满意度”,
“value”: “100”
},
{
“index_id”: 112,
“area_id”: “18335624”,
“name”: “满意度”,
“value”: “20”
}, {
“index_id”: 114,
“area_id”: “18335524”,
“name”: “满意度”,
“value”: “10”
},
{
“index_id”: 113,
“area_id”: “18335625”,
“name”: “满意度”,
“value”: “80”
}
];
Math.min.apply(Math, array.map(function(o) {return o.value}))
就这样获取了最大和最小数据
本文链接:https://my.lmcjl.com/post/2606.html
展开阅读全文
4 评论