Created
April 25, 2018 06:40
-
-
Save Security2431/bacbc65686ac8da89e64fcffffa9ace9 to your computer and use it in GitHub Desktop.
Thousends prettify separator
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
prettify(num) { | |
const n = num.toString() | |
return n.replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g, "$1" + " ") | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment