Created
April 10, 2018 16:14
-
-
Save eban5/ef3f48ef44b46cbcf47310480702b017 to your computer and use it in GitHub Desktop.
Display long int with commas at the thousandths place
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
//credit to elias-zamaria | |
const numberWithCommas = (x) => { | |
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment