JavaScript by Victor Talmacinschi • June 21, 2022
const map = new Map();
map.set('🍎', 'Apple');
map.set('🍊', 'Orange');
map.set('🍇', 'Grape');
// To get an array of the keys:
const keys = Array.from(map.keys());
// To get an array of the values:
const values = Array.from(map.values());
// Or, if you don't need an array, you can iterate over the map entries:
for (const [key, value] of map) {
console.log(key, value);
}
0
21.062
JavaScript by Victor Talmacinschi • June 21, 2022
const map = new Map();
map.set('🍎', 'Apple');
map.set('🍐', 'Pear');
map.set('🍊', 'Orange');
// To get an array of the keys:
const keys = Array.from(map.keys());
// Log the array of keys
console.log(keys);
// ['🍎', '🍐', '🍊']
0
21.062