본문 바로가기
IT 자료

javascript 천단위 콤마

by 성곤 2017. 9. 29.
반응형

javascript 천단위 콤마




1
2
3
4
5
function numberWithCommas(x) {
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
 
 
cs



출처 : https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript?page=2&tab=active#tab-top


반응형