js中tofixed()方法

toFixed()方法可把number四舍五入为指定小数位数的数字

例子:

var n=parseFloat(input).toFixed(2);

posted @ 2020-12-10 18:53  我和我的小生活  阅读(464)  评论(0编辑  收藏  举报