js 小程序 toFixed(2)出现很多位小数

43 阅读1分钟

x = 0.5454545455

x.toFixed(2) * 100;

54.000000000001 ......

解决方案:

(x * 100).toFixed(2);

参考自:blog.csdn.net/honeycandys…