Skip to content

Instantly share code, notes, and snippets.

@hendriklammers
Created September 12, 2012 18:58
Show Gist options
  • Save hendriklammers/3709109 to your computer and use it in GitHub Desktop.
Save hendriklammers/3709109 to your computer and use it in GitHub Desktop.
Javascript: Sort array by property value
function dynamicSort(property) {
return function (a, b) {
return (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment