Created
October 25, 2019 02:54
-
-
Save liuxd/6bc846187f5895a66f14801f0dc60d6d to your computer and use it in GitHub Desktop.
[convert number to dollar]
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 show_dollar(num) { | |
return '$' + num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment