how to check if map has a key in js code example
Example 1: check if a key is in a map
if ( m.find("f") == m.end() ) {
// not found
} else {
// found
}
Example 2: js check if map contains key
const map1 = new Map();
map1.set('bar', 'foo');
console.log(map1.has('bar'));
// expected output: true
console.log(map1.has('baz'));
// expected output: false