Question 1
How can you iterate over all the keys in a Map?
map.keys()
map.values()
map.forEach()
map.getKeys()
Question 2
Map in JavaScript?Stack
Queue
Hash Table
Binary Search Tree
Question 3
Map?map.contains(key)
map.has(key)
map.exists(key)
map.includes(key)
Question 4
const map = new Map();
map.set(42, 'value1');
map.set('42', 'value2');
console.log(map.get(42));
'value1'
'value2'
undefined
Error
Question 5
Map?map.remove(key)
map.delete(key)
map.erase(key)
map.drop(key)
Question 6
Map using map.get(key)? O(1)
O(n)
O(log n)
O(n log n)
Question 7
const map = new Map();
map.set(true, "boolean");
map.set(1, "number");
map.set("1", "string");
console.log(map.get(1));
boolean
number
string
undefined
Question 8
const map = new Map();
map.set('1', 'one');
map.set(1, 'ONE');
console.log(map.get('1'));
ONE
one
undefined
Error
Question 9
Map?map.removeAll()
map.clear()
map.deleteAll()
map = new Map();
Question 10
Map into an array of its values?map.toArray()
[...map]
[...map.values()]
Array.from(map.values())
There are 10 questions to complete.