recipeMap.forEach((value, key) => {
console.log(`${key} costs ${value}`);
});
let map1 = new Map();
map1.set('name', 'Jack');
map1.set('age', '27');
// looping through Map
for (let [key, value] of map1) {
console.log(key + '- ' + value);
}
let map = new Map();
map.set('key1', 'value1');
map.set('key2', 'value2');
for (let [key, value] of map.entries()) {
console.log(key + ' - ' + value)
}
let map1 = new Map();
map1.set('name', 'Jack');
map1.set('age', '27');
// looping through the Map
for (let key of map1.keys()) {
console.log(key)
}
let map1 = new Map();
map1.set('name', 'Jack');
map1.set('age', '27');
// looping through the Map
for (let values of map1.values()) {
console.log(values);
}
map.values((value) => /* do whatever with value */)