JSFiddle - React, Tailwind, and code Playground

by shivaay123

HTML

<!DOCTYPE html>
<html>

<body>

    <script>
        var numb = 45342.764;

        var valu = Math.round(Number(numb) * 100) / 100;

        var pts = valu.toString().split(".");

        var num = pts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",") + (pts[1] ? "." + pts[1] : "");

        console.log(num);
        
    </script>

</body>
</html>