The Javascript Map delete()
method removes the element from a Map object by key.
myMap.delete(key);
It returns true if an element in the Map object existed and has been removed.
It returns false if the element does not exist.
var myMap = new Map(); myMap.set('bar', 'foo'); console.log(myMap);/*from ww w . j a v a2 s . c o m*/ const b = myMap.delete('bar'); console.log(b); console.log(myMap); console.log(myMap.has('bar'));