JS: Map.prototype

By Xah Lee. Date: . Last updated: .

New in ES2015.

Map.prototype is the value of the property key "prototype" of the function Map.

[see JS: Map Object]

console.log( Map.hasOwnProperty ( "prototype" ) ); // true

Type

Type of Map.prototype is object.

[see JS: Value Types]

// type of Map.prototype
console.log ( typeof Map.prototype === "object" ); // true
console.log ( Object.prototype.toString.call( Map.prototype ) === "[object Map]" ) // true

Parent

Parent of Map.prototype is Object.prototype.

// parent of Map.prototype
console.log ( Object.getPrototypeOf ( Map.prototype ) === Object.prototype ); // true

[see JS: Prototype and Inheritance]

Purpose

Purpose of Map.prototype object is to provide methods and properties useful for all map instances.

Map.prototype is the parent of all map instances.

console.log ( Object.getPrototypeOf ( new Map() ) === Map.prototype ); // true

[see JS: the Map Object Tutorial]

Properties

value properties

  1. Map.prototype.constructor
  2. Map.prototype.size
  3. Map.prototype.[Symbol.toStringTag]

get, set

  1. Map.prototype.get
  2. Map.prototype.set
  3. Map.prototype.has
  4. Map.prototype.delete
  5. Map.prototype.clear

loop

  1. Map.prototype.forEach
  2. Map.prototype.entries
  3. Map.prototype [ Symbol.iterator ] → same as Map.prototype.entries
  4. Map.prototype.keys
  5. Map.prototype.values

Reference

ECMAScript 2015 §Keyed Collection#sec-properties-of-the-map-prototype-object

Map Topic

  1. JS: the Map Object Tutorial
  2. JS: Map Object
  3. JS: Map.prototype
  4. JS: Iterate Over Map Object
  5. JS: Convert Object to/from Map
  6. JS: Map Filter
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.