Skip to content

Instantly share code, notes, and snippets.

@73nko
Created August 8, 2018 06:16
Show Gist options
  • Save 73nko/809924d6234341b2889b0ed4b622056f to your computer and use it in GitHub Desktop.
Save 73nko/809924d6234341b2889b0ed4b622056f to your computer and use it in GitHub Desktop.
Function to remove ducplicates from array using reduce.
Array.prototype.removeDuplicates = function(){
return this.reduce((result,nextItem)=>result.includes(nextItem) ? result : result.concat(nextItem),[]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment