Skip to content

Instantly share code, notes, and snippets.

@odyniec
Created September 16, 2012 20:27
Show Gist options
  • Save odyniec/3734249 to your computer and use it in GitHub Desktop.
Save odyniec/3734249 to your computer and use it in GitHub Desktop.
Iterating over sorted properties of an object (JavaScript 1.8.5)
object = { foo: 42, bar: 43, baz: 44 };
Object.keys(object).sort().every(function (key) {
console.log(key + ' -> ' + object[key]);
// Keep going
return true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment