JSFiddle - React, Tailwind, and code Playground

by shivaay123

HTML

<!DOCTYPE html>
<html>

<body>

    <script>
      
    var numb = 45342.76;

    function numbCommas(x) {
      return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
    }
    console.log(numbCommas(numb));  
    </script>

</body>
</html>