-1

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.

1 Answers1

0

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})
Abhineet
  • 632
  • 3
  • 16