how to delete an object with an object key from a map object?
for example if i created a map object called members
const members = new Map();
here's the normal way for adding a new object inside members
//members.set(key, value);
members.set('Evelyn',{name: 'Evelyn', age: 25});
//here's how can we delete this object
members.delete('Evelyn');
but when i started reading about map objects in es6 i was confused that the keys can be an object too!!
Map is an object that lets you store key-value pairs where both the keys and the values can be objects
if so how can i delete the one with the object key ?
//key as an object
members.set({id: 1}, {
name: 'Evelyn',
age: 30
});
const myKey = { id: 1 };. Now usemyKeyas first param to set and delete.idas key? do you have a special reason, why it should be an object?