Skip to content

Instantly share code, notes, and snippets.

@amarema
Last active August 13, 2019 13:27
Show Gist options
  • Save amarema/ac60f08058a82100162acdab7e90181b to your computer and use it in GitHub Desktop.
Save amarema/ac60f08058a82100162acdab7e90181b to your computer and use it in GitHub Desktop.
Divide number into groups
const numberWithCommas = x => 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