개발하자/자바스크립트

자바스크립트 천단위 콤마찍기 (정규식)

i구야 2018. 2. 20. 17:13

function addCommas(x) {

return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");

}