This question has already been answered:

I get for example the number of 1,000,000 or 10,000 or any other. How can I convert them separated by 3 characters from the end point.

For example, 1000000 => 1.000.000 or 10000 => 10.000

Reported as a duplicate by participants Alex , Air , Community Spirit Mar 2 '18 at 13:02 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Suddenly, who can use result = 1000000; result += ""; result = result.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1.') result = 1000000; result += ""; result = result.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1.') result = 1000000; result += ""; result = result.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1.') - Sergey Kozin
  • one
    Possible duplicate.stackoverflow.com/questions/499397/… - Pyramidhead

1 answer 1

 var a = 1000000; console.log(a); console.log(a.toString()); console.log(a.toLocaleString());