Skip to content

Instantly share code, notes, and snippets.

@mornir
Created March 13, 2018 07:58
Show Gist options
  • Save mornir/0dca37ce8e1262a9847e0a7073714636 to your computer and use it in GitHub Desktop.
Save mornir/0dca37ce8e1262a9847e0a7073714636 to your computer and use it in GitHub Desktop.
sorting array of objects
function sortListBy(Parameter, List) {
return List.sort((a, b) => {
if (a[Parameter] > b[Parameter]) {
return 1
} else {
return -1
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment