Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add comma thousands separator: https://stackoverflow.com/a/2901298
function 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