How to iterate over a map in Typescript
You can iterate over a map using the forEach
method.
For example
Given the map:
const myMap: Map<string, number> = new Map();
myMap.set('a', 1);
myMap.set('b', 2);
myMap.set('c', 3);
myMap.forEach((value: string, key: number) => {
// do something
})