JavaScript: Map.prototype.clear

By Xah Lee. Date: . Last updated: .

New in JS2015.

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);
BUY ΣJS JavaScript in Depth