Apply your JS skills to key Mozilla projects as an MDN Fellow! http://mzl.la/MDNFellowship

mozilla
Your Search Results

    Map.prototype

    This is an experimental technology, part of the ECMAScript 6 (Harmony) proposal.
    Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.

    Summary

    The Map.prototype property represents the prototype for the Map constructor.

    Property attributes of Map.prototype
    Writable no
    Enumerable no
    Configurable no

    Description

    Map instances inherit from Map.prototype. You can use the constructor's prototype object to add properties or methods to all Map instances.

    Properties

    Map.prototype.constructor
    Returns the function that created an instance's prototype. This is the Map function by default.
    Map.prototype.size
    Returns the number of key/value pairs in the Map object.

    Methods

    Map.prototype.clear()
    Removes all key/value pairs from the Map object.
    Map.prototype.delete(key)
    Removes any value associated to the key and returns the value that Map.prototype.has(value) would have previously returned. Map.prototype.has(key) will return false afterwards.
    Map.prototype.entries()
    Returns returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order.
    Map.prototype.forEach(callbackFn[, thisArg])
    Calls callbackFn once for each key-value pair present in the 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)
    Returns the value associated to the key, or undefined if there is none.
    Map.prototype.has(key)
    Returns a boolean asserting whether a value has been associated to the key in the Map object or not.
    Map.prototype.keys()
    Returns a new Iterator object that contains the keys for each element in the Map object in insertion order.
    Map.prototype.set(key, value)
    Sets the value for the key in the Map object. Returns the Map object.
    Map.prototype.values()
    Returns a new Iterator object that contains the values for each element in the Map object in insertion order.
    Map.prototype[@@iterator]()
    Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order.

    Specifications

    Specification Status Comment
    ECMAScript 6 (ECMA-262)
    The definition of 'Map.prototype' in that specification.
    Release Candidate Initial definition.

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support 38 13 (13) 11 25 7.1
    Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support Not supported 38 13.0 (13) Not supported Not supported

    iOS 8

    See also

    Document Tags and Contributors

    Last updated by: jpmedley,