JSFiddle - React, Tailwind, and code Playground
JavaScript
(function (old) {
var dec = 0.12 .toLocaleString().charAt(1),
tho = dec === "." ? "," : ".";
if (1000 .toLocaleString() !== "1,000.00") {
Number.prototype.toLocaleString = function () {
var f = this.toFixed(2).slice(-2);
return this.toFixed(2).slice(0,-3).replace(/(?=(?!^)(?:\d{3})+(?!\d))/g, tho) + dec + f;
}
}
})(Number.prototype.toLocaleString);
document.body.innerHTML = 10000 .toLocaleString() + "<br/>" + 123456.789 .toLocaleString();