One that might catch out folks hoping to wing it on their Python knowledge alone — JavaScript doesn’t have a good dict equivalent.

“Eloquent JavaScript” by Marijn Haverbeke explains the issue in https://eloquentjavascript.net/2nd_edition/06_object.html

My more condensed example would be:

> "toString" in ({"alice": 100, "bob": 200})
true

Alternatives

Map type

MDN discusses pros and cons

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

Explicitly create an Object with a null prototype

In my case, I was interested in particular creating such objects when parsing JSON. This StackOverflow answer was helpful: https://stackoverflow.com/a/48260948

JSON.parse() method accepts a callback that could be used to transform object into prototypeless object.

JSON.parse(string, function(k, v) {
   if (v && typeof v === 'object' && !Array.isArray(v)) {
     return Object.assign(Object.create(null), v);
   }
   return v;
});

https://esdiscuss.org/topic/proposal-add-an-option-to-omit-prototype-of-objects-created-by-json-parse