vue求arr数组里的平均值
arr = ['25%', '30%', '40%', '5%']; //vue求arr数组里的平均值
let newArr= arr .map(percentStr => {
return parseFloat(percentStr.slice(0, -1));
});
let total = newArr.reduce((sum, value) => sum + value, 0);
_this.totalmlv = (total / newArr.length).toFixed(2);
console.log(_this.totalmlv+'%')