LeB*_*eau 4 javascript math jquery rounding
我需要舍入到小数点后1位
如果我的号码是80.02,我需要它是80.1.
试着
Math.ceil( (80.02).toFixed(1) ) but this rounds the number up to 81
我怎样才能做到这一点?
Mil*_*war 6
使用Math.ceil( number * 10 ) / 10;了四舍五入
Math.ceil( number * 10 ) / 10;
将它固定到一个小数位
(Math.ceil( number * 10 ) / 10).toFixed(1);
工作小提琴
小智 -1
你应该使用地板而不是天花板
Math.floor( (80.02).toFixed(1) )
归档时间:
12 年,2 月 前
查看次数:
6225 次
最近记录:
6 年,3 月 前