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)
}
Map<String, String> map = ...
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println(entry.getKey() + "/" + entry.getValue());
}
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 */)
for (let [key, value] of map.entries()) {
console.log(key, value);
}
map.forEach(function(value, key) {
console.log(key + ' = ' + value);
})