-1

I would like to print out millions(or more) like 321.100.401 . Do you have any good method?

Ereske12
  • 1
  • 1

2 Answers2

0

If you don't need it to use periods as the separator, toLocaleString will convert a number to a string using the current locale.

var num = 5000;
console.log(num.toLocaleString());
mwerschy
  • 1,698
  • 1
  • 15
  • 26
0

Just take Number.prototype.toLocaleString with an appropriate parameter like 'de-DE'.

document.write((321100401).toLocaleString('de-DE'));
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392