js循环数组,js循环json,四舍五入后保留多少位小数

    js循环数组:

    for(var i=0;i<res.data.length;i++){

        res.data[i]['fdmAmt'] = parseFloat_e(res.data[i]['fdmAmt'])     //parseFloat有小数点也正常(会保留小数点)

    }

    js循环json的方法:

    for (var i in this.count) {

        this.count[i].rebate = this.count[i].rebate.toFixed(1)          //js四舍五入然后保留多少位小数的写法

    }

猜你喜欢

转载自blog.csdn.net/ljw_jiawei/article/details/83142077