why we use weakset in javascript code example
Example: weakset in es6
/*
WeakSet() is as same as Set()
Similarities:
1.WeakSet() has all methods that Set() has.
2.WeakSet() Donot contain Duplicate Values as Set().
Differences:
3.WeakSet Values are Non Enumerated
4.WeakSet Value can only be Empty Objects
*/
var weak = new WeakSet();
weak.add({});
var a={};
weak.add(a);