Skip to content

Instantly share code, notes, and snippets.

@stiekel
Created April 28, 2015 05:13
Show Gist options
  • Save stiekel/95526f20ec6915a594c6 to your computer and use it in GitHub Desktop.
Save stiekel/95526f20ec6915a594c6 to your computer and use it in GitHub Desktop.
JavaScript ksort
function ksort(obj){
var keys = Object.keys(obj).sort()
, sortedObj = {};
for(var i in keys) {
sortedObj[keys[i]] = obj[keys[i]];
}
return sortedObj;
}
@mmdt12
Copy link

mmdt12 commented Aug 17, 2023

excellent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment