Skip to content
Related Articles

Related Articles

JavaScript Map Complete Reference

Improve Article
Save Article
  • Last Updated : 23 Nov, 2022
Improve Article
Save Article

JavaScript Map is a collection of elements where each element is stored as a key, value pair. Map objects can hold both objects and primitive values as either key or value. When we iterate over the map object it returns the key, and value pair in the same order as inserted.



Example: Below is an example of a Map.forEach() method.


    // Creating a map using Map object
    let mp=new Map()
    // Adding values to the map
    // Logging map object to console



The complete list of JavaScript Map are listed below:


JavaScript Map Methods Description 
JavaScript Map.clear( ) MethodThe Map.clear() method in JavaScript has used the removal all the elements from a map and make it empty.
JavaScript Map.delete() MethodThe Map.delete() method in JavaScript is used to delete the specified element among all the elements which are present in the map.
JavaScript Map.entries( ) Method The Map.entries() method in JavaScript is used for returning an iterator object which contains all the [key, value] pairs of each element of the map. 
JavaScript Map.forEach() MethodThe Map.forEach method is used to loop over the map with the given function and executes the given function over each key-value pair.
JavaScript Map.get( ) MethodThe Map.get() method in JavaScript is used for returning a specific element among all the elements which are present in a map.
JavaScript Map.has( ) MethodThe Map.has() method in JavaScript is used to check whether an element with a specified key exists in a map or not.
JavaScript Map.keys() MethodThe Map.keys() method is used to extract the keys from a given map object and return the iterator object of keys.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!