ES6 使用WeakSet


ES6 使用WeakSet

'use strict'
   let weakSet = new WeakSet();  
   let obj = {msg:"hello"};
   weakSet.add(obj);
   console.log(weakSet.has(obj));
   weakSet.delete(obj);
   console.log(weakSet.has(obj));