JavaScript Map and Set Explained

preview_player
Показать описание
In this video we will look at some of the new data structures.
ES6 Introduced Maps and Sets to JavaScript. Understand difference between JavaScript objects and Maps and Sets and Arrays.
Рекомендации по теме
Комментарии
Автор

Set
3:10 add method
4:33 delete method
5:07 clear method
5:33 has method
6:00 size property

Map
12:05 set method
12:57 delete method
13:45 clear method
14:04 has method
14:40 size property

felipeog
Автор

Man I Thank You Strongly For Make Everything Crystal Clear..

qatadd
Автор

So helpful and easy to understand with your explanations and example cases. Thank you!

haydennharper
Автор

Jaha pana Tusi Great ho :). A beginner like me in Javascripts. I was able to understand your map & set concepts and am able to implement the same in my code. working successfully. Thanks & God bless you

vijayyadavs
Автор

Thanks for the explanation! And from my understanding 'Set' is the best way to always ensure correct key order which a regular object can't rely on.

Karlponken
Автор

the way youre explaining is so different. such clarity

frankliva
Автор

Your coding flow is nice. The smooth use of shortcuts and line movements are fantastic.

rahuls
Автор

Nice video, please make one more for advance use of SET and MAP, covering more scenarios, where it should be used practically instead of any other data structure.

deepakkaithwas
Автор

Wow, no more search abt JS Set n Map, thank U so much Bro!👍

LiveEveryMoment_WithLOVE.
Автор

Hi, adding all those empty objects to the map (at ~12:34) was a bit misleading. From my tests, I'm pretty sure that you would never have been able to run myMap.delete({}) or myMap.has({}) because each of those empty objects is stored at a different location in memory. So what's the point in creating them? You appeared to be showing that one of the advantages of Map compared to a regular object is that you can create duplicate keys in a map (i.e. multiple empty objects). But in fact ''duplicate" keys are NOT possible in myMap. In your example, each empty object you create as a key is a different thing in memory. And because you have created those keys without a reference to them in memory, i.e. being stored as a variable, once those keys are created, you can no longer access them using .has({}). Let me know if I'm wrong.

bridgetfitzgerald
Автор

thaks for this awesome tutorial, very helpful, cleared my confusion about sets and maps. thnks

kiwi-Centaur
Автор

nicely problem solution approach! keep it up

longnhat
Автор

Thanks for the video. But, in the Map, why would you want to have an empty object as the key? How would you access that item in the Map

blyfo
Автор

so maps can hold any value as either the key or value from what ive read.
which means the key itself can be any primitive value or object. im having trouble understanding what the use case would be for using an object as a key? i just cant seem to wrap my brain around it was wondering if you had any insight?

knightfallgame
Автор

Really nice explanation, thanks you. I expected to also learn Map.get.

veermetri
Автор

A video with more practical examples would be great! Nice video!

samueltorres
Автор

For your information, you can not store multiple same keys of type number or string in MAP. Multiple same keys can only work with non-primitive datatype, when set as a key

VishalGupta-jsdev
Автор

Clear and concise! But you forgot to mention the get methods to get the value after setting

rajeevpurohit
Автор

Thank you. Really appreciate this vid. Subbed!

benabernethy
Автор

Thank you for this video!!! I finally know how to use a Map!!! :D

teachhelphotline