- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Map Methods
JavaScript Map & Set
JavaScript Map Methods
Map methods let you loop over entries and convert to and from other structures.
A Map is iterable, so spread and for of both work.
Array methods need a conversion step first.
Example
Example
javascript
const scores = new Map([["Ada", 90], ["Grace", 95]]);
console.log([...scores.keys()].join(","));
console.log([...scores.values()].join(","));