Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matthewoestreich/3e0a5e63ba55c1477a96b5b7df624e52 to your computer and use it in GitHub Desktop.
Save matthewoestreich/3e0a5e63ba55c1477a96b5b7df624e52 to your computer and use it in GitHub Desktop.
function getDistinctObjectsBasedUponPropertyValue(array, distinctProperty) {
var tempArray = []
return array.filter(function (n) {
return tempArray.indexOf(n[distinctProperty]) == -1 && tempArray.push(n[distinctProperty])
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment