javascript – thousands separator to 4 digit number using ToLocaleString does not work


I have a multilanguage application, in which I format the values ​​to be displayed using javascript with the native ToLocaleString function, to which I pass the culture in which we are working. The problem is that the thousands separator is not working on 4 digit numbers. Example:

console.log(parseInt('10000').toLocaleString('es-CL'));// 10.000
console.log(parseInt('20000').toLocaleString('es-CL'));// 20.000
console.log(parseInt('1000').toLocaleString('es-CL'));// 1000 no separa miles
console.log(parseInt('2000').toLocaleString('es-CL'));// 2000 no separa miles


In my case I used it Number (n) .toLocaleString ("de-DE", {minimumFractionDigits: 0}); for it to print> 5,000> 10,000> etc

Scroll to Top