Skip to content

Instantly share code, notes, and snippets.

@codemilli
Last active April 10, 2016 10:17
Show Gist options
  • Select an option

  • Save codemilli/24d95dc50f94b66a84403d1e37b85b0b to your computer and use it in GitHub Desktop.

Select an option

Save codemilli/24d95dc50f94b66a84403d1e37b85b0b to your computer and use it in GitHub Desktop.
let wm = new WeakMap();
let key = {a: 1};
wm.set(key, 1).set({b: 2}, 2);
console.log(wm); // WeakMap {Object {a: 1} => 1, Object {b: 2} => 2}
// after the garbage collector has run
console.log(wm); // WeakMap {Object {a: 1} => 1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment