Posted By

rg443 on 07/21/12


Tagged

javascript number format


Versions (?)

Last Edited at 07/21/12 02:08am

Viewed 2 times

format numbers in javascript with group digits


/ Published in: JavaScript

format numbers in javascript with group digits

  1. Number.prototype.format = function () {
  2. return this.toString().split( /(?=(?:\d{3})+(?:\.|$))/g ).join( "," );
  3. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.