Created
May 11, 2024 05:39
-
-
Save leoli0605/44dbc658c5ded573054cd409102312c8 to your computer and use it in GitHub Desktop.
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 number = 123456.789; | |
console.log(new Intl.NumberFormat('en-US', {style: 'currency', currency: 'USD'}).format(number),); | |
// $123,456.79 | |
console.log(new Intl.NumberFormat('en-US', {style: 'currency', currency: 'TWD'}).format(number),); | |
// NT$123,456.79 | |
console.log(new Intl.NumberFormat('en-US', {style: 'currency', currency: 'CNY'}).format(number),); | |
// CN¥123,456.79 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Intl