本文主要是介绍如何变成java代码?,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Array(size).fill(1).forEach((item, index) => {
let amt = getRandomMoney(size - index, remainMoney);
list.push(amt);
remainMoney = remainMoney - amt;
})
let result_a = list.map((a) => {
return a + floating;
});
let result_t = result_a.reduce((pre, current) => {
return pre + current
}, 0);
console.log("result_t ",_.round(result_t, 2), result_a.join(" | "))
let t2 = result_a.map((a) => {
return _.round(a, 2)
});
let t3 = t2.reduce((pre, current) => {
return pre + current
}, 0);
console.log("四舍五入之后 : ", Math.round(t3), "--------", t2.map(a=>a.toFixed(2)).join(" | "))
console.log("小部分 总数: ",
list.reduce((pre, current) => {
return pre + current
}, 0))
console.log("百分比: ", list.map(a=>a.toFixed(2)).join(" | "))
}
这篇关于如何变成java代码?的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!