复制代码代码如下所示:
var a=3.1415926;
a a.tofixed(2); / /保持2但结果为字符串型
a parseFloat(); / /浮充转换结果
下面的话/一步一步
a parseFloat(a.tofixed(2));