49

Working with Sets

In this Chapter

  • Learn all about the Set data structure

  • Understand how to use sets to avoid duplicate items in the collection

When it comes to storing a collection of data, arrays probably come to mind first. They’ve been around forever, are very flexible, and contain a boatload of properties that make using them a breeze. Over the past few years, JavaScript gained another way to store a collection of data. That way is via this mysterious array-looking creature known as a set. On the surface, arrays and sets look similar:

images

But there are a bunch of characteristics that make them different. The biggest characteristic is ...

Get Javascript Absolute Beginner's Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.