When working with JavaScript, it is common to deal with lists of data: user IDs, email addresses, tags, categories, product names, search results, and more. The problem is that these lists often contain duplicates.

That is where Set becomes really useful.

A Set is a built-in JavaScript object that stores unique values only. This means that if you try to add the same value more than once, JavaScript will automatically keep only one copy.

const numbers = [1, 2, 2, 3, 4, 4];

const cleanNumbers = [...new Set(numbers)];