To check if a key exists in a Map, use the .has() method:
.has()
map.has(key);
Example:
const map = new Map([[1, 2], [3, 4]]); console.log(map.has(1)); // true console.log(map.has(2)); // false