javascript number comma thousands

북마크 추가

 

 

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

function numberWithCommas(x) {

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

}

 

numberWithCommas(1000000)

-> return 100,0000

HKH
2016-01-27 13:43
SHARE
keyboard_arrow_left
keyboard_arrow_up