Search posts, tags, users, and pages
Jennifer Bland
Senior Software Engineer. Google Developers Expert. Entrepreneur. Mountain Climber. Cat Lover. Gardener. World traveler.
Sometimes you have an array of data and you want to remove all duplicates from the array. In this article, I will show you three ways in which you can do this. 1) Remove duplicates using forEach and includes The Array includes() method determines whe...
Philip Birk-Jensen
Great examples!
I like approach 2 the most, a tiny bit slower than #1 (not tested, just a hunch since the filter() function tends to be slower than forEach()), but easier to read and understand (a matter of taste).
filter()
forEach()
Philip,
#3 is my favoriate :-)
Philip Birk-Jensen
Great examples!
I like approach 2 the most, a tiny bit slower than #1 (not tested, just a hunch since the
filter()function tends to be slower thanforEach()), but easier to read and understand (a matter of taste).