- 
      
- 
        Save mouyong/a8c03726ea66e28efec351d36cc6ef77 to your computer and use it in GitHub Desktop. 
    JavaScript ksort
  
        
  
    
      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 ksort(obj){ | |
| var keys = Object.keys(obj).sort() | |
| , sortedObj = {}; | |
| for(var i in keys) { | |
| sortedObj[keys[i]] = obj[keys[i]]; | |
| } | |
| return sortedObj; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment