javascript - trying to show currency based on user's locale -


what's best solution show currency based on user's locale? know there's tolocalestring('en-us', {style}) there away detect location of user instead show currency?

don't think window.navigator.languages solution? though gives array of languages ['en-us', 'en', 'something', 'en-gb'], not sure if gonna same if user somewhere else.

also don't think multiple tolocalstring() works, thought solution seems takes 1 locale.

var number = 100; number.tolocalestring('en-us', { style: 'currency', currency: 'usd'}, 'en-gb', {style: 'currency',currency: 'gbp'}) 


Comments