JavaScript 小技巧

in Code with 0 comment
  1. Js如何实现四舍五入,保留两位小数
var num = 16.4723;
num = Math.round(16.4723 * 100) / 100;
关于Math.round()方法请参考,MDN文档
Comments are closed.