Created
July 8, 2023 02:30
-
-
Save kironroy/6e4597de4273f85c5db72be1730f6e99 to your computer and use it in GitHub Desktop.
internationalizing numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const options2 = { | |
// style: 'unit', | |
style: 'currency', | |
// unit: 'mile-per-hour', | |
unit: 'celsius', | |
currency: 'EUR', | |
// useGrouping: false, | |
}; | |
const num2 = 3885673.23; | |
console.log('US: ', new Intl.NumberFormat('en-US', options2).format(num2)); | |
console.log('Germany:', new Intl.NumberFormat('de-DE', options2).format(num2)); | |
console.log('Syria:', new Intl.NumberFormat('ar-SY', options2).format(num2)); | |
console.log( | |
'Browser:', | |
new Intl.NumberFormat(navigator.language, options2).format(num2) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment