const set = new Set();
const x = { id: 'some object' };
foo.add(x);
foo.has(x);
> true
I'm guessing you're taking issue with the fact that it uses reference equality instead of structural equality, which can definitely be a pain point. There's a proposal to improve the situation with "Records and Tuples" [0], but it's been stuck in committee hell for years.
[0] https://github.com/tc39/proposal-record-tuple