Maps and Sets
Map Lookup
Read a value by key from a Map.
Map Lookup
map_lookup.js
const item = "tea";
const price = new Map([
["tea", 3],
["cake", 5],
["juice", 4],
]).get(item);
console.log("item=" + item);
console.log("price=" + price);
map-lookup
A `Map` stores key-value pairs. Use `.get(key)` when the lookup key is data instead of a fixed property name.