@WebDevSimplified

Map Video: https://youtu.be/yJDofSGTSPQ?t=558

@antonpieper

Important: If you use objects as keys, they are compared by reference equality. So if you use .get({userId: 1}), you'll get undefined as {userId: 1} is a new object.

@shawn-skull

i can feel his anxiety to not go over time. 💀

@MDo-ww9wm

Maps are useful but this is not a good explanation why. Maps advantages over plain objects are:
- insertion order is preserved
- they can be indexed using any type including objects*
- they provide their own iterators for their keys, values and entries

* The drawback is it implies having a pointer to the key object elsewhere in memory in order to access the value. This isn't mentioned in the video even it's crucial to know.

@myfertriedcoding

bro's got that giga chad face

@ninguern7693

In most of the cases that I use a map I just need to map strings to other things, I don't need to add, change or delete anything, like mapping tailwind classes. In this cases, what do you think is better, the object or this Map? The Map syntax just looks a bit more confusing with the array of arrays

@clarkhinchcliff7824

There are trade-offs between standard objects and Map().

Please don't prioritize using Map() over objects. Avoid them unless you need special keys like functions or are just making a hashMap.

Iteration over objects is trivial, whereas Map iteration is... different. 

If you do use Map objects (which is fine for data lookup), just understand that Map() is missing for...in functionality. You have to use for...of. 

If you wind up using for...in, there won't be an error and your code will 'run' without functioning.

@puopg

Ah yes boy how I love maps with keys as multiple types. More marinara sauce please

@NegativoSiempre

I started working on angular just as signals launched, not because i was excited or knew about angular but because of a job change.
To me learning angular has been the best thing i’ve done, it’s so powerful, and now with signals i actually say it’s pretty darn easy to use, at least compared to some legacy code that i’ve had to maintain. I’m glad the community is falling in love with this framework again

@junzhengca

Important caveat: Map cannot be serialized, so not good for anything you want to persist.

@orcwarrior.

Apart from performance concerns already raised. I would add degraded code readability at the top, accessing, adding new keys to object-based maps are super-simple 😎

@edupazz

for me who works with React, most of the data I manage need to be serialized somehow, and Maps aren't serializable, what makes them useless

@shapelessed

My favorite use case for maps is being able to map a socket connection to a user session. No more setting IDs on the connection's object and mapping that to a session.

@HARSHSIKE

Thanks!

@Aman_io765

You just explained clearly thanks bro😊

@wolfgang1977

Using an object as key is really bad practice. 

Not sure if this is correct for Javascript but in other programming languages you are using maps for performance because they have another search key algorithm.

@sney2002

I don't think it's a good idea to use an object as a key, if you lost the reference to the object, you can't access the value by key again

@hobi_coding

I did that 15 years ago in C++ using std::map

@ichigoplayss376

I’m a junior Developer and I love using map paired with forEach to reduce my time complexity.

@sven4423

Thank you for making all these awesome tutorials I have learned allot from them!