1const map1 = new Map();
2map1.set('bar', 'foo');
3
4console.log(map1.has('bar'));
5// expected output: true
6
7console.log(map1.has('baz'));
8// expected output: false
1The has() function of the map object accepts a key in string format and returns a boolean value of true if the specified key exists. Otherwise, the function returns false.