js 保留两位小数 javascript

alert((0.9996*100).toFixed(2));  

得到99.96,这是我想要的! 使用Number.toFixed()可以格式数字显示任意的小数位!

原文地址:https://www.cnblogs.com/mayufo/p/4418171.html