0

how to convert the number into million formats with two decimal points I tried with this code. My Input is milFormate(1000);

milFormate(value){
  var nf = new Intl.NumberFormat();
  return nf.format(value).toLocaleString();
}

my output is 10,100

I expected should be 10,100.00 how can I achieve this

achu
  • 639
  • 2
  • 10
  • 26

1 Answers1

3

You can use minimumFractionDigits option in order to achieve that:

function milFormate(value){
  var nf = new Intl.NumberFormat('en-IN', { minimumFractionDigits: 2  });
  return nf.format(value);
}
Paweł Kuffel
  • 451
  • 2
  • 5