Skip to main content

Map and WeakMap

Learn Map and WeakMap (Phase 6 · Array Methods, Map, Set (Essential), JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Map: a real dictionary • new Map() stores key-value pairs where keys can be any value (objects, functions, numbers), remembers insertion order and has a size . • API: set , get , has , delete , clear , keys , values , entries , forEach . It is iterable with for...of .

More lessons in Phase 6 · Array Methods, Map, Set (Essential)