This should at least be an option, and possibly the default behavior:
(12345.6).toLocaleString() // '12,345.6' in the US
(12345.6).toLocaleString('de-DE') // '12.345,6' in firefox, '12,345.6' in node.js :(
(12345.67).toLocaleString('en-US', {maximumFractionDigits: 1}) // '12,345.7'
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
Note that it doesn't work properly in node.js - the German example uses US formatting there :(
Also note that local seems to be required in order to pass in any options :(
This should at least be an option, and possibly the default behavior:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
Note that it doesn't work properly in node.js - the German example uses US formatting there :(
Also note that local seems to be required in order to pass in any options :(