# javascript 把數字加上千分位符號 ```javascript= function FormatNumber(n) { n = Math.floor(n); //無條件捨去 n += ""; var arr = n.split("."); var re = /(\d{1,3})(?=(\d{3})+$)/g; return arr[0].replace(re, "$1,") + (arr.length == 2 ? "." + arr[1] : ""); } ``` ###### tags: jquery/javascript
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up