Created
August 30, 2021 07:28
-
-
Save jupegarnica/a56259277ba41854dc53d45c63daed62 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 toCurrency = (n:number, curr:string, LanguageFormat:string|undefined = undefined):string => | |
Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n); | |
console.log( | |
toCurrency(123456.789, 'EUR') // €123,456.79 | currency: Euro | currencyLangFormat: Local | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment