编程语言
首页 > 编程语言> > 如何变成java代码?

如何变成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(" | "))

}

标签:pre,java,log,代码,current,let,result,return,变成
来源: https://blog.csdn.net/m0_57359035/article/details/120503333