Created
August 2, 2018 07:43
-
-
Save andreyshr/72f948f79a5e22e6cd68311748053102 to your computer and use it in GitHub Desktop.
formatDigits(str)
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
function formatDigits(str) { | |
return str.toString().replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 '); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment