千分位保留4位小数

function format(input) {
            var n = parseFloat(input).toFixed(4);
            var re = /(d{1,3})(?=(d{3})+(?:.))/g;
            return n.replace(re, "$1,");
        }

  

原文地址:https://www.cnblogs.com/songfahzun/p/5007731.html