How to Remove a Value from a Map in JavaScript
In this lesson, we will see how to remove a value from a map in JavaScript, sometimes we want to remove a value from a map in JavaScript so how can we do that?
The delete() method
To do that we can use the delete() method that takes the key of the value as an argument and remove it.
const myMap = new Map([['name','john'],['age',22],['city','london']]);
myMap.delete('name');
console.log(myMap);
//true Map(2) {'age' => 22, 'city' => 'london'}