It’s a shame that JavaScript still has no built-in support for equality checks and that its support for cloning (not part of ECMAScript, but supported by virtually all platforms) has significant limitations—e.g., the clone of an instance of C is not an instance of C:
class C {}
const clone = structuredClone(new C());
assert.equal(clone instanceof C, false);
assert.equal(
Object.getPrototypeOf(clone),
Object.prototype
);
More information: https://2ality.com/2022/01/structured-clone.html