JavaScript: Map.prototype.clear

By Xah Lee. Date: . Last updated: .

New in JS2015.

map_obj.clear()

Deletes all entries of the map map_obj.

Return undefined.

const m = new Map([[3, "n3"], [4, "n4"], [5, "n5"] ]);

// clear map, return undefined
console.log( m.clear() === undefined ); // true

// cleared
console.log(m); // Map {}
JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Map

prototype