Last Updated: February 25, 2016
·
1.003K
· hidakatsuya

Generate a comma-separated number by JavaScript one-liner

'1234567'.replace(/(\d)(?=(\d{3})+(?!\d))/g, 
                               function() { return arguments[1] + ',' });
// => '1,234,567'