map = new Map();
map.set('key1', 'value1');
map.set('key2', 'value2');
for (let [key, value] of map.entries()) {
console.log(key + ' - ' + value)
}
const object = {'a': 1, 'b': 2, 'c' : 3};
for (const [key, value] of Object.entries(object)) {
console.log(key, 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)
}
for (let key of map) {
console.log(key);
}
map.forEach(function(value, key) {
console.log(key + ' = ' + value);
})