JavaScript ES6 Maps vs Objects

preview_player
Показать описание
ES6 introduced the Map datatype. In many cases, the Map type is a good replacement for Objects.
Maps have a get and set method for manipulating the key value pairs inside the Map.
Any datatype - Strings, Numbers, Objects, or Symbols can be used as the keys inside of a Map.

Рекомендации по теме
Комментарии
Автор

Best description of Map versus simply utilizing the default JS object I've seen so far. Definitely will be trying to master the Map asap. Very, very useful.

JustSujC
Автор

this guy is one of the rarest tutors on youtube and by far the most underrated channels, he actually teaches you, @Steve Griffith much respect and thank you.

abdull-rahmanhajhassan
Автор

You should tell the usecases, advantages and uses of map over objects. I seriously did not get why we are should use map

urwrong
Автор

Im still wondering why this channel has not 500.000 subs yet.
Whenever I want to look some JS concept up, I checkout uncle Steve...

losrobbosful
Автор

If I wanted to increment the value for specific keys in a map, how would I do that? In object literals, it would be like obj[key]++

ogbanana
Автор

Great video! Really helped me understand what Map was about.
I just have one question:

"let a = { 'name': 'Sherlock' };" means that "characters.set(a, 'Detective');" is essentially
characters.set( { 'name': 'Sherlock' }, 'Detective');

So I'm wondering why when I try to get using other variable holding the same object value, it won't work
let c = { 'name': 'Sherlock' }; // is equal to a

// undefined

paulhong
Автор

what's the difference between Map and a Weak Map. I saw the use of Weak Map to create private members of ES6 classes. Or if you get a chance to make a video with use cases where to use Map/WeakMap/Symbol

deependrasinghshekhawat
Автор

The concepts of OOP still apply to JavaScript Maps right?

BoredBricks
Автор

You should do a course on JS Data Structures and Algos

thickerthoughts
Автор

why would someone use object as a key for other objects ?

debasishpothal
Автор

What kind of psycho uses a white background??? o.O

Jokes aside, great lesson. Thanks!

.mhz