JS: Map.prototype.clear
(new in ECMAScript 2015)
mapObj.clear()-
Deletes all entries.
Return undefined.
const xx = new Map([[3, "n3"], [4, "n4"], [5, "n5"]]); // clear map, return undefined console.log(xx.clear() === undefined); // cleared console.log(xx.size === 0);
JavaScript. Methods for map object
- JS: Map.groupBy
- JS: Map.prototype.size
- JS: Map.prototype.get
- JS: Map.prototype.getOrInsert
- JS: Map.prototype.getOrInsertComputed
- JS: Map.prototype.set
- JS: Map.prototype.has
- JS: Map.prototype.delete
- JS: Map.prototype.clear
- JS: Map.prototype.forEach
- JS: Map.prototype.keys
- JS: Map.prototype.values
- JS: Map.prototype.entries