I want to put comma in currency value.

Example: Here is the input and expected output

input
1234
output
1,234


input
1234567
output
1,234,567


input
123373.3333
output
123,373.33


I'm using

valuestring=valuestring.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");

but this code does not format 123373.3333=>123,373.33

How do I fix it ?