Map, Map, Map, Map
Think super objects
Use the syntax
new Map([
['key', 'value']
])
to update a map you can use the set method
const myMap, = new Map([
['key', 'value']
])
myMap.set('key', 'value')
to see all of your key-value pairs,
myMap.forEach(value, key) => {console.log(key, value);
});
WeakMap is useful for if you want to use an object as a key.
Top comments (0)