JavaScript: Maps and Sets
1h 10mBeginner2025-03-07
Authors

Jamie Pittman
Full-Stack Software Developer
Course details
Programming languages are always evolving and changing, and JavaScript is no exception. Over time, JavaScript has grown, and many new aspects have been added, including maps and sets. JavaScript maps and sets may sound simple, but they aren't quite the same as their counterparts in other programming languages. In this course, software engineer Jamie Pittman covers the ins and outs of JavaScript maps and sets, their syntax, how they work, and how to integrate them into your daily coding practice. Topics covered include a general overview of these features, when and where to use them, their WeakMap and WeakSet versions, and the various methods and properties associated with them.
Skills covered
JavaScriptOracleProgramming LanguagesSoftware DevelopmentDeep Dive (X:Y)
Concepts
Introduction
- Get to know JavaScript maps and sets
- What you should know
Maps
- The Map object defined
- Build your Map object with the set method
- Access a value with get
- Does the map have your key
- Determine map size
- Remove key-value pairs with clear and delete
- Map - Keys and values methods
- Map contents with the entries method
- Loop over a map with forEach
- Group entries with groupBy
- Solution - Maps 1
- Solution - Maps 2
WeakMaps
- What is the WeakMap object
- Same methods, different map
Sets
- The Set object defined
- Add values to your set
- Does Set have your value
- Get your set size
- Delete and clear values in your set
- Iterate over values in a set
- Iterate over a set with entries
- Iterate over your set with forEach
- Solution - Sets 1
- Solution - Sets 2
WeakSets
- What is the WeakSet object
- Same methods, different set
Conclusion
- Next steps