Created
March 23, 2017 14:33
-
-
Save basilalex/4c0b5457725243f27edf1aa1d1d68898 to your computer and use it in GitHub Desktop.
Ставит запятые в числах
This file contains 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 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