Skip to content

Instantly share code, notes, and snippets.

@eban5
Created April 10, 2018 16:14
Show Gist options
  • Save eban5/ef3f48ef44b46cbcf47310480702b017 to your computer and use it in GitHub Desktop.
Save eban5/ef3f48ef44b46cbcf47310480702b017 to your computer and use it in GitHub Desktop.
Display long int with commas at the thousandths place
//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