Created
July 9, 2018 12:45
-
-
Save nairihar/dd2522bdf846c1d269f32f17d3f4087a to your computer and use it in GitHub Desktop.
JavaScript series, part 3, WeakMap and WeakSet, medium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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