01 / 06
Map has types for keys and values
Map holds key–value pairs. Unlike an object, the key can be anything, not just a string.
In TypeScript you declare it as Map<key type, value type> in angle brackets.
const scores = new Map<string, number>();scores.set("Yui", 80);scores.set("Kei", 65);console.log(scores.get("Yui"));Result
80