Skip to content

Instantly share code, notes, and snippets.

@oakmac
Created December 24, 2013 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oakmac/8106856 to your computer and use it in GitHub Desktop.
Save oakmac/8106856 to your computer and use it in GitHub Desktop.
var people = [
{
firstName: 'Phil',
lastname: 'Gambling',
age: 31
},
{
firstName: 'Chris',
lastName: 'Pounds',
age: 26
}
];
people.sort(function(a, b) {
return a.age - b.age;
});
people.sort(function(a, b) {
return (a.firstName + ' ' + a.lastName) - (b.firstName + ' ' + b.lastName);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment