2

What's the best solution to show currency based on the user's locale? I know there's toLocaleString('en-US', {style}) but is there away to detect the location of the user instead then show their currency?

Don't think window.navigator.languages will be a good solution? though this gives array of languages ['en-US', 'en', 'something', 'en-GB'], not sure if this is always gonna be the same if the user somewhere else.

Also I don't think multiple toLocalString() works, thought it could be a solution but seems like it only takes one locale.

var number = 100;
number.toLocaleString('en-US', { style: 'currency', currency: 'USD'}, 'en-GB', {style: 'currency',currency: 'GBP'})
2

0