Skip to content

Instantly share code, notes, and snippets.

@bonyiii
Created September 7, 2012 14:38
Show Gist options
  • Save bonyiii/3666732 to your computer and use it in GitHub Desktop.
Save bonyiii/3666732 to your computer and use it in GitHub Desktop.
javscript find duplicates
sorted = window.items.sort((a,b) -> a.track_id - b.track_id)
results = []
for item,i in sorted
if i < sorted.length - 1 && sorted[ i + 1 ].element_id == sorted[i].element_id
results.push sorted[i]
results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment