方法1:
数字.toLocaleString(
'en-US'
);
例如:(123456789.2333).toLocaleString('en-US'
);
方法2:
function
format(input) {
var
n = parseFloat(input).toFixed(2);
var
re = /(\d{1,3})(?=(\d{3})+(?:\.))/g;
return
n.replace(re,
"$1,"
);
}
format(123456789.2333)