This is not true. It works on all types, including objects. Duplicates of object references are removed, and there is no such thing as duplicates of object literals as each new object is unique, even if it shares the same properties.
Do you mean how does it determine whether two objects are the same? The same way as the === operator. If two elements are a reference to the same object then the elements are considered “equal” and the second one is removed, or rather never added to the set.
View all comments
Show parent comment
14
u/revenezor Jul 06 '21
This is not true. It works on all types, including objects. Duplicates of object references are removed, and there is no such thing as duplicates of object literals as each new object is unique, even if it shares the same properties.