Set and WeakSetSet is unique collection of objects. Difference between Set and WeakSet is that in WeakSet, garbage collection may happen when object stored in set gets out of scope. Sets can store primitive as well as non primitive values. Weakset stores only objects. WeakSet does not have size property and methods like keys, values, clear,entries etc.
Map and WeakMapSet is collection of objects as key and values. Difference between Map and WeakMap is that in WeakMap, garbage collection may happen when object stored in map gets out of scope.
Complex problems, Simple Solutions