JavaScript Map Data Structure

Creating a Map

We create a map using Map Constructor.

Adding Items

Using the set() method we can add items to a map. this method this two arguments,the initial one is for key and the second one is for value.

Deleting Items

Using delete() method requires one argument which is the name of that item.

Searching for Items

Sometimes you wanna search for a specific item in a Set use has() method which takes one argument that argument is the key of that object you’re seeking for. if that item is available returns true else returns false.

Returning the value of a Map item

Using the get() method we can return the value of a map.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahmadullahnikzad

Ahmadullahnikzad

17 Followers

I am a web developer who writes web development content for you to make web development easier