JSFiddle - React, Tailwind, and code Playground

by Sibeesh Venu

JavaScript

Number.prototype.format = function(){
   return this.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
};
var num=123456;
alert(num.format());