浏览代码

Number.toDecimal

MaiXinRong 8 年之前
父节点
当前提交
faf200870b
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      public/web/number_util.js

+ 5 - 0
public/web/number_util.js

@@ -1,6 +1,11 @@
 /**
  * Created by chen on 2017/7/5.
  */
+
+Number.prototype.toDecimal = function (ADigit) {
+    return parseFloat(this.toFixed(ADigit));
+};
+
 var  number_util = {
     isNumber : function (obj) {
         return obj === +obj;