JavaScript · Middle · Question 30 of 75

How does WeakMap differ from Map?

Explanation

If there are no other references to a key object, the entry disappears with it. That's why WeakMap has no size or iteration. Uses: private data for objects, a metadata cache for DOM nodes without memory leaks.

Further reading

Problem with a question

JavaScript · Middle · question 30

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz