Instantly share code, notes, and snippets.

Embed
What would you like to do?
Array.prototype.removeDuplicates = function(){
return this.reduce((result,nextItem)=>result.includes(nextItem) ? result : result.concat(nextItem),[]);
}
@anuja-cci

This comment has been minimized.

anuja-cci commented Aug 13, 2018

Very beautiful use of reduce function, but in the above example, the above function does not work for any of the internet explorers as "includes" function is not supported by internet explorer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment