.get() js code example
Example 1: js get array item by property
const jsObjects = [
{id: 1, displayName: "First"},
{id: 2, displayName: "Second"},
{id: 3, displayName: "Third"},
{id: 4, displayName: "Fourth"}
]
var result = jsObjects.find(obj => {
return obj.id === 1
})
console.log(result)
Example 2: node get value from map
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"));