Check Key in Map

Use has() to check if a key exists in a Map.

Preview

Code

<script>
let map = new Map();

map.set("id",101);

console.log(map.has("id"));
console.log(map.has("name"));
</script>

More JS Maps Examples (7)