Skip to content

Instantly share code, notes, and snippets.

@hashmaparraylist
Created August 25, 2014 07:59
Show Gist options
  • Save hashmaparraylist/85d74c4ad1055d6c8b17 to your computer and use it in GitHub Desktop.
Save hashmaparraylist/85d74c4ad1055d6c8b17 to your computer and use it in GitHub Desktop.
逗号分隔数字
// 输出结果: 12,345
String(12345).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment