- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Map
JavaScript Map & Set
JavaScript Map
A Map stores key and value pairs where the key can be any type.
An object can only use strings and symbols as keys.
A Map can use numbers, objects, or anything else.
Example
Example
javascript
const scores = new Map();
scores.set("Ada", 90);
console.log(scores.get("Ada"));
console.log(scores.size);