我需要四舍五入到小数点后一位
如果我的号码是 80.02,我需要它是 80.1。
尝试过
Math.ceil( (80.02).toFixed(1) ) but this rounds the number up to 81
我怎样才能做到这一点?
最佳答案
使用 Math.ceil( number * 10 )/10;
进行四舍五入
固定小数点后一位
(Math.ceil(number * 10)/10).toFixed(1);
关于Javascript 或 Jquery 四舍五入到小数点后一位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20212753/