RsD0p9BK
2/26/2016 - 5:15 AM

Sort JavaScript object by key

Sort JavaScript object by key

Object.keys(unordered).sort().forEach(function(key) {
  var value = unordered[key];
  delete unordered[key];
  unordered[key] = value;
});

// http://stackoverflow.com/questions/5467129/sort-javascript-object-by-key