MDN wants to learn about developers like you:

This is a new technology, part of the ECMAScript 2015 (ES6) standard.
This technology's specification has been finalized, but check the compatibility table for usage and implementation status in various browsers.

El mètode clear() esborra tots els elements d'un objecte de tipus Map.




Utilitzar el mètode clear

var myMap = new Map();
myMap.set("bar", "baz");
myMap.set(1, "foo");

myMap.size;       // 2
myMap.has("bar"); // true


myMap.size;       // 0
myMap.has("bar")  // false


Especificació Estat Comentaris
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Map.prototype.clear' in that specification.
Standard Definició inicial.

Compatibilitat amb navegadors

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic 38 19.0 (19.0) 11 25 7.1
Característica Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic No support 38 19.0 (19.0) No support No support 8

Vegeu també

Document Tags and Contributors

 Contributors to this page: enTropy
 Last updated by: enTropy,