javascript number comma thousands

북마크 추가

 

 

=============================================================

function numberWithCommas(x) {

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

}

 

numberWithCommas(1000000)

-> return 100,0000

AD
관리자
2016-01-27 13:43
SHARE