JavaScript で数字を 3 桁ずつカンマで区切る (commify)
2012-07-12-1: [JavaScript]
var commify = function(s) {
return s.toString()
.split('').reverse().join('')
.replace(/(\d\d\d)(?=\d)(?!\d*\.)/g, '$1,')
.split('').reverse().join('');
};