Hacker News new | ask | show | jobs
by inglor 3505 days ago
JavaScript maps can have object keys, you're just using objects as dictionaries. Objects in python don't typically have non-string keys.

```js var m = new Map(); var o = {}; // some object m.set(o, 5); m.get(o); // 5 ```

2 comments

Map are not supported by most IE version, and even IE 11 doesn't support half of the API. The android browser doesn't support it at all either. Bottom line, you couldn't not have used Map during the last past years, and used objects for dict.
Not too much people write plain JS anymore, and it is not that hard to build transpiling pipeline. Sometimes you have a small project and you don't want to deal with all this nonsense, but then you are writing code in one file and it is very small jquery style enhancements.

So, if you need objects as keys in dictionaries, then there is a big chance that you can use transpiling already (modules, other ES6 features).

Please, don't take it as an offence, just a suggestion – I really don't see a problem here.

> ```js var m = new Map(); var o = {}; // some object m.set(o, 5); m.get(o); // 5 ```

That guy who thought markdown was supported by hacker news. LOL ! I've been through that too...