The Map.prototype property represents the prototype for the Map constructor.
Property attributes of Map.prototype
| |
|---|---|
| Writable | no |
| Enumerable | no |
| Configurable | no |
Map instances inherit from Map.prototype. You can use the constructor's prototype object to add properties or methods to all Map instances.
Map.prototype.constructorMap function by default.Map.prototype.sizeMap object.Map.prototype.clear()Map object.Map.prototype.delete(key)true if an element in the Map object existed and has been removed, or false if the element does not exist. Map.prototype.has(key) will return false afterwards.Map.prototype.entries()Iterator object that contains[key, value] for each element in the Map object in insertion order.Map.prototype.forEach(callbackFn[, thisArg])Map object, in insertion order. If a thisArg parameter is provided to forEach, it will be used as the this value for each callback.Map.prototype.get(key)key, or undefined if there is none.Map.prototype.has(key)key in the Map object or not.Map.prototype.keys()Iterator object that contains the keys for each element in the Map object in insertion order.Map.prototype.set(key, value)key in the Map object. Returns the Map object.Map.prototype.values()Iterator object that contains the values for each element in the Map object in insertion order.Map.prototype[@@iterator]()Iterator object that contains[key, value] for each element in the Map object in insertion order.| Specification | Status | Comment |
|---|---|---|
| ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Map.prototype' in that specification. | Standard | Initial definition. |
| ECMAScript Latest Draft (ECMA-262) The definition of 'Map.prototype' in that specification. | Draft |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 38 | 12 | 13 | 11 | 25 | 8 |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 38 | 38 | 12 | 14 | 25 | 8 | Yes |
| Server | |
|---|---|
| Node.js | |
| Basic support | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/prototype