Skip to content

Instantly share code, notes, and snippets.

@nairihar
Created July 9, 2018 12:45
Show Gist options
  • Save nairihar/dd2522bdf846c1d269f32f17d3f4087a to your computer and use it in GitHub Desktop.
Save nairihar/dd2522bdf846c1d269f32f17d3f4087a to your computer and use it in GitHub Desktop.
JavaScript series, part 3, WeakMap and WeakSet, medium
const weakSet = new WeakSet();
const obj = {};
weakSet.add(obj);
weakSet.has(obj);
// true
weakSet.delete(obj);
// true
weakSet.add(1);
// Uncaught TypeError: Invalid value used in weak set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment