Created
          June 6, 2018 04:39 
        
      - 
      
 - 
        
Save mgmgpyaesonewin/360177aa44a6ecc4ac4a8c4fbaab9cf1 to your computer and use it in GitHub Desktop.  
    1000 => 1,000; 1000000 => 1,000,000
  
        
  
    
      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 number_with_commas(x) { | |
| return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment