Last active
June 28, 2018 14:05
-
-
Save allysonsilva/809dbb6861deb1bc9329065423406e77 to your computer and use it in GitHub Desktop.
π’ Native JavaScript Currency [NumberFormat]
This file contains hidden or 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
let formatter = new Intl.NumberFormat('pt-BR', { | |
style: 'currency', | |
currency: 'BRL', | |
currencyDisplay: "symbol", | |
minimumFractionDigits: 2, | |
}); | |
formatter.format('123456.90')); // R$Β 123.456,90 | |
formatter.format('12.3456.90')); // NaN | |
formatter.format('12,3456.90')); // NaN | |
formatter.format('123456,90')); // NaN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment