Skip to content

Instantly share code, notes, and snippets.

@xincici
Created May 27, 2015 06:29
Show Gist options
  • Save xincici/5e7344b6e2e65b672a56 to your computer and use it in GitHub Desktop.
Save xincici/5e7344b6e2e65b672a56 to your computer and use it in GitHub Desktop.
数字加千分位
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