javascript has code example
Example 1: check if set has value js
const mySet = new Set();
mySet.add(15);
console.log(mySet.has(33))
cosole.log(mySet.has(15))
Example 2: node map has value
let myMap = new Map();
myMap.set("key1", "value1");
myMap.set("key2", "value2");
console.log(myMap.has("key1"));
console.log(myMap.has("key2"));
console.log(myMap.get("key1"));
console.log(myMap.get("key2"));
Example 3: .has js
const map1 = new Map();
map1.set('bar', 'foo');
console.log(map1.has('bar'));
console.log(map1.has('baz'));
Example 4: .has js
The 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.