← TechnologyThe essentials of

Set: remove repeated values with clear borders

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 10:06. This is not editorial approval.

In a few sentences

In brief

Set keeps unique values. However, two separately created objects remain different, even if their properties appear to be the same.

Useful to know

Set is a collection of unique values. It is handy when from a list of repeating codes you want multiple without repetitions. Values can be primitives or references to objects. [1]

For example, [...new Set(['bg', 'en', 'bg'])] gives ['bg', 'en']. External square brackets with spread turn the result back into an array. This is its own short example, not a function for normalizing language codes.

The uppercase and lowercase letters do not automatically become the same. If the application rule considers 'BG' and 'bg' to be one code, you must first normalize them according to this rule. Set cannot guess it on its own.

In objects, uniqueness refers to the references themselves. Two separate literals {id: 1} are not a single object. To remove duplicated id entries, you need to extract or use the identifier instead of expecting a comparison of all nested properties.

Sources

For further detail and to check the information:

  1. [1] MDN — Set ↗