728x90
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
728x90
'Front-end > js' 카테고리의 다른 글
ArrayFunction 2 (find, filter) (0) | 2021.12.14 |
---|---|
Array Function 1 (Map) (0) | 2021.12.13 |
유용한 Array 함수들 (0) | 2021.12.08 |
Optional chaining (?.) 와 Nullish coalescing (??) (0) | 2021.11.23 |
js type (0) | 2021.11.22 |