Q: How to format the number? I was looking for the answer but haven't been able find the right one So I have following numbers and I would like to format it in the following way

*

*450.03,999,999 -> 450.03

*2,597.6,099,999 -> 2,597.60

*69.2 -> 69.20

*100,780.090,100 -> 100,780.09

Could you assist with this issue? Thank you in advance.

A: you can get it done this way. I hope it would work for you.
let value = "2,597.6,099,999";
let num = Number(value.replace(/,/g, ""));
let result = num.toLocaleString(undefined, {minimumFractionDigits: 2})

