Skip to content

Instantly share code, notes, and snippets.

@justinpeterman
Created January 24, 2012 07:09
Show Gist options
  • Save justinpeterman/1668647 to your computer and use it in GitHub Desktop.
Save justinpeterman/1668647 to your computer and use it in GitHub Desktop.
sort an array of objects based on a particular obj property
function compare(a,b) {
if (a.PARAM1 < b.PARAM2)
return -1;
if (a.PARAM1 > b.PARAM2)
return 1;
return 0;
}
ARRAY_OBJECTS.sort(compare);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment