/ Published in: JavaScript

format numbers in javascript with group digits
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Number.prototype.format = function () { return this.toString().split( /(?=(?:\d{3})+(?:\.|$))/g ).join( "," ); };
Comments
