Export (0) Print
Expand All

delete Method (Map) (JavaScript)

Removes the specified element from a map.



Required. A Map object.


Required. The key of the element to remove.

true if the element has been removed.

The following example shows how to add members to a Map and then delete one of them.

var m = new Map();
m.set(1, "black");
m.set(2, "red");
m.set("colors", 2);

m.forEach(function (item) {
    document.write(item.toString() + "<br />");

// Output:
// red
// 2

Supported in the Internet Explorer 11 standards document mode. Also supported in Store apps (Windows 8.1 and Windows Phone 8.1). See Version Information. Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Not supported in Windows 8.

© 2014 Microsoft