0👍
Just use Number.prototype.toLocaleString. It’s implemented in JavaScript 1.5 (which was introduced in 1999) so it’s basically supported across major browsers.
var num = 34523459
console.log('$ ' + num.toLocaleString())
Source:stackexchange.com