js小数点问题

toFixed(2)    第三位小数开始四舍五入

 

let da=0.0318726

Number(da.toString().match(/^\d+(?:\.\d{0,2})?/));

 

posted @ 2022-03-01 00:41  haveProgress  阅读(39)  评论(0编辑  收藏  举报