Modern JavaScript
About Lesson

In this JavaScript lesson we are going to learn about JavaScript Set & Map, before this in JavaScript we had just object and arrays collection, but now you can use set and map in JavaScript. Map holds key value pair.

 

 

Now let’s create an example of Map in JavaScript.

 

 

You can check the existence of an item in a map by using has().

 

 

Also you can check the size of the map.

 

 

 

Now let’s iterate over the map, for this we are using for of loop.

 

 

Sets are like arrays, but it stores unique values, we can not add duplicate values in the set.

 

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found