Created
April 25, 2017 22:40
-
-
Save NFodrea/2f1d19dba325782f18df3db681b0fcb6 to your computer and use it in GitHub Desktop.
ES6 price format
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
| function formatPrice(cents) { | |
| return `$${(cents / 100).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment