Created
January 31, 2021 04:27
-
-
Save steveshead/188dbdab45d35bf5e12fcf0f03942445 to your computer and use it in GitHub Desktop.
[Javascript function to format currency] - using Intl formatting to convert currency and locale
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 formatCurrency = function (value, locale, currency) { | |
new Intl.NumberFormat(locale, { | |
style: 'currency', | |
currency: currency, | |
}).format(value); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment