Skip to content

Instantly share code, notes, and snippets.

@codemilli
Last active April 10, 2016 10:04
Show Gist options
  • Save codemilli/1efc235f38f61530efb9b29f2b1c2acb to your computer and use it in GitHub Desktop.
Save codemilli/1efc235f38f61530efb9b29f2b1c2acb to your computer and use it in GitHub Desktop.
let ws = new WeakSet();
let value = {a: 'hacker'};
ws.add(value).add({b: 'moon'});
console.log(ws); // WeakSet {Object {a: "hacker"}, Object {b: "moon"}}
// after the garbage collector has run
console.log(ws); // WeakSet {Object {a: "hacker"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment