js reduce 求和误差
const formatNum = function(f, digit) { var m = Math.pow(10, digit); return Math.round(f * m,10) / m; } let sum= arr.reduce((t,c)=>formatNum(t+c.money,10),0);
const formatNum = function(f, digit) { var m = Math.pow(10, digit); return Math.round(f * m,10) / m; } let sum= arr.reduce((t,c)=>formatNum(t+c.money,10),0);