js map has in objects code example
Example 1: javascript map
const myArray = ['Sam', 'Alice', 'Nick', 'Matt'];
const newArray = myArray.map(name => {
return 'My name is ' + name;
});
console.log(newArray);
const anotherArray = myArray.map((value, index) => index + ": " + value);
console.log(anotherArray);
console.log(myArray);
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"));