我的需求是正常显示小数点后的数值,不固定保留几位;
所以(a*100+b*100)/100这种不适用,tofixed()也不适应。
(1)
parseFloat((2.22 + 0.1).toFixed(10))
补充:保留小数点后两位(其他写法)
this.money = this.money.substring(0,this.money.indexof('.')+3)
我的需求是正常显示小数点后的数值,不固定保留几位;
所以(a*100+b*100)/100这种不适用,tofixed()也不适应。
(1)
parseFloat((2.22 + 0.1).toFixed(10))
补充:保留小数点后两位(其他写法)
this.money = this.money.substring(0,this.money.indexof('.')+3)