Created
December 18, 2018 23:10
-
-
Save phylaxis/8bb43c5d29e16b473d891b7019a6c176 to your computer and use it in GitHub Desktop.
Currency Formatting
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
var amount = 12345.99; | |
//prepare number formatter | |
const formatter = new Intl.NumberFormat('en-US', { | |
style: 'currency', | |
currency: 'USD', | |
minimumFractionDigits: 2 | |
}); | |
//Format the amount | |
console.log( formatter.format( amount ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment