WeakSet & WeakMap Interview Questions – WeakSet & WeakMap Online Quiz

Question 1:  What is a key difference between WeakMap and Map in JavaScript?

Question 2:  What type of values can be stored in a WeakSet?

Question 3:  Can you iterate over the elements of a WeakSet?

Question 4:  What happens when an object in a WeakMap is no longer referenced elsewhere?

Question 5:  Which of the following methods is available in WeakMap?

Question 6:  Can WeakMap keys be garbage collected if they are not referenced elsewhere?

Question 7:  Which is true about WeakSet in JavaScript?

Question 8:  What method is used to add an element to a WeakSet?

Question 9:  What happens if you try to use a string as a key in WeakMap?

Question 10:  Which is a use case for WeakMap in JavaScript?

Leave a Reply