Explain it in 60 seconds
Map, Set, WeakMap and WeakSet
Frontend Engineering · JavaScript Core · Intermediate
When should you use Map, Set, WeakMap and WeakSet instead of plain objects and arrays?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Map: any key type, ordered, size, frequent add/remove.
- Set: unique values.
- WeakMap/WeakSet: object keys held weakly (GC-friendly).
- Not iterable (weak).
- Use for metadata, caches.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.