Hacker News new | ask | show | jobs
by eviks 1145 days ago
Why did they not make the map assigning syntax as convenient as with objects, instead going for the clunky get/set?
2 comments

Because a Map is an Object. It has properties and methods. The only way to provide a safe and clean namespace for your keys is to provide an explicit API. It also supports keys that can be not only strings or symbols.
Several things such as standard way for adding, removing and checking for keys, built-in size property, extensibility.

You think "key in object" is better than "maaaaap.has(key)"? I don't because it's unpredictable and prone to exceptions.

Give them a try. It's not a complete replacement for regular old objects