How to Check if a Map Has a Value in JavaScript
In this lesson, we will see how to check if a map has a value in JavaScript, sometimes we want to check if a map has a value in JavaScript so how can we do that?
The has() method
To do that we can use the has() method that takes the key of the value as an argument and returns true if the value exists and false if not.
const myMap = new Map([['name','john'],['age',22],['city','london']]);
console.log(myMap.has('name'));
//true