Use Number.toLocaleString() with style:'currency':
(73.57).toLocaleString('de-DE',{style:'currency',currency:'EUR'}); // German: 73,57 €
(73.57).toLocaleString('en-US',{style:'currency',currency:'EUR'}); // American: €73.57
Note that:
- This does not get regional settings, but provides output in regional settings.
- If you want your locale to be determined dynamically, use navigator.language.
- There are many other means aside from this native approach; for starters, take a look at accounting.js or Stack Overflow answers like this one.
As Daniel Jackson commented:
Using Intl.NumberFormat.format(), you can achieve identical results, with the NumberFormat and the general Intl objects offering versatile options and methods with a main focus on language sensitivity.
new Intl.NumberFormat('de-DE',{style:'currency',currency:'EUR'}).format(73.57); // DE: 73,57 €
new Intl.NumberFormat('en-US',{style:'currency',currency:'EUR'}).format(73.57); // US: €73.57