添加值

要向 WeakSet 添加值,请使用 .add() 方法。这种方法是可链接的。

const obj1 = {},
      obj2 = {};

const weakset = new WeakSet();
weakset.add(obj1).add(obj2);