Created
May 27, 2015 06:29
-
-
Save xincici/5e7344b6e2e65b672a56 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 format(num){ | |
return (num.toFixed(2) + '').replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment