-4 44571.123 * 75.46 = 3363336.94158,但我想要的值3363336.942。所以,做我写的代码在Java脚本如何四舍五入数字小数位 来源 2014-11-04 Sourabh +1 number.toFixed(numberOfDecimals) – lascort 2014-11-04 12:05:55 +0 '(44571.123 * 75.46).toFixed(3)' – Andy 2014-11-04 12:07:17 +1 有一本手册可以阅读 - > https://developer.mozilla.org/en-US/docs/Web/JavaScript /参考/ Global_Objects /数字/ toFixed – Andy 2014-11-04 12:08:11
0 可以使用toFixed()功能,像这样: var sum = (44571.123 * 75.46); var decimal = sum.toFixed(3); 其中3的要小数位的数量。 来源 2014-11-04 12:27:32
number.toFixed(numberOfDecimals) – lascort 2014-11-04 12:05:55
'(44571.123 * 75.46).toFixed(3)' – Andy 2014-11-04 12:07:17
有一本手册可以阅读 - > https://developer.mozilla.org/en-US/docs/Web/JavaScript /参考/ Global_Objects /数字/ toFixed – Andy 2014-11-04 12:08:11