123.toFixed(2)
start只能是数值型,result是string类型。
'123.45Mb'.parseFloat()
start任意类型,result为数值型。如果前值有小数,那么会保留;如果为123.00,那么小数不会不留。
问题:
toFixed有一个精度的问题,eg:0.235.toFixed(2); // 0.23
兼容性问题:
如果前值
参考:https://blog.csdn.net/qq_22038259/article/details/85860951
https://www.imooc.com/article/46329
腾讯云:https://cloud.tencent.com/developer/article/1353799