by kevincox · 3y ago · 0 comments
I think MDN has a good comparison: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
The only real downside of maps is that they don't support JSON serialization. However you can fix this pretty easily by using a map with an overridden `toJSON` for serializable keys.
class StringMap extends Map {
toJSON() {
return Object.fromEntries(this);
}
}