diff --git a/js/script.js b/js/script.js index e95bdb0..0db6726 100644 --- a/js/script.js +++ b/js/script.js @@ -572,26 +572,11 @@ if (/MSIE [5-9]/.test(navigator.userAgent)) { app.filter("niceNum", function () { return function (num) { - var niceNum = ""; - var step = 1; - - while (num >= 1) { - rest = num % 1000; - - //Put it in a nice string - if (num > 1000) { - if (rest < 10) { - rest = "00" + rest; - } else if (rest < 100) { - rest = "0" + rest; - } - } - - niceNum = rest + "'" + niceNum; - num = Math.floor(num / 1000); + if (isNaN(num)) { + throw new Error("Input is not a number"); } - return niceNum === "" ? "0" : niceNum.substring(0, niceNum.length - 1); + return parseInt(num, 10).toLocaleString(); }; });