Use toLocaleString() with style:'currency' :
var amount = 123.56; alert( 'German: ' + amount.toLocaleString('de-DE',{style:'currency',currency:'EUR'}) + ', ' + 'American: ' + amount.toLocaleString('en-US',{style:'currency',currency:'EUR'}) );
Note that:
- Not like getting regional settings, but output in regional settings.
- Getting a currency depends on your use case.
- If you want your language to be defined dynamically, use
navigator.language . - There are many other remedies, not this native approach; For starters, take a look at accounting.js or stack overflow answers like this one.
source share