JavaScript Tricks #1 - Remove Duplicates From Array

Опубликовано: 03 Март 2021
на канале: Benjamin Carlson
1,816
47

JS Tricks #1

Remove duplicate items from an array using set! You can also do this using the .filter() method but using set is cleaner and easier!

From developer.mozilla.org:

Set objects are collections of values. You can iterate through the elements of a set in insertion order. A value in the Set may only occur once; it is unique in the Set's collection. Because each value in the Set has to be unique, the value equality will be checked. In an earlier version of ECMAScript specification, this was not based on the same algorithm as the one used in the === operator. Specifically, for Sets, +0 (which is strictly equal to -0) and -0 were different values. However, this was changed in the ECMAScript 2015 specification. See "Key equality for -0 and 0" in the browser compatibility table for details.

Read more: https://developer.mozilla.org/en-US/d...

Gear: https://benjamincarlson.io/gear

Like my videos and want to support me? Consider sponsoring me on GitHub: https://github.com/sponsors/bjcarlson42

CONTACT: business.benjamincarlson@gmail.com

Connect with me:
Website: https://benjamincarlson.io
Twitter:   / bjmncrlsn  
Github: https://github.com/bjcarlson42
LinkedIn:   / bjcarlson42  
Medium:   / benjamincarlson  
Newsletter: https://buttondown.email/benjamincarlson


На этой странице сайта вы можете посмотреть видео онлайн JavaScript Tricks #1 - Remove Duplicates From Array длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Benjamin Carlson 03 Март 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,816 раз и оно понравилось 47 зрителям. Приятного просмотра!