Closed nik-christou closed 4 years ago
More examples/resource so I don't forget later:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat
https://flaviocopes.com/how-to-format-number-as-currency-javascript/
Example: const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 2 })
formatter.format(1000) // "$1,000.00" formatter.format(10) // "$10.00" formatter.format(123233000) // "$123,233,000.00"
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString