set and map in javascript

Set and WeakSet

Set 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 WeakMap

Map 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.


Web development and Automation testing

solutions delivered!!