73nko
8/8/2018 - 6:16 AM

Function to remove ducplicates from array using reduce.

Function to remove ducplicates from array using reduce.

Array.prototype.removeDuplicates = function(){ 
  return this.reduce((result,nextItem)=>result.includes(nextItem) ? result : result.concat(nextItem),[]); 
}