Thanks for your response man! I agree with you that if the Object is typed as we do in TypeScript you would not have a big issue with missing properties.

But my point with Vanilla JavaScript you don’t have a type system. (I’m a big TypeScript fan 😉) In that case, we are all human and make mistakes. And with the Map you don’t get that error which can interrupt the user experience.

Next to the Map optional chaining can also solve this problem. What do you think about that?

Written by

I write stories about Frontend Dev, JavaScript, Typescript, Angular, NodeJS, Serverless Functions, JAM Stack, FaunaDB, Netlify, Apple, iOS— https://byrayray.dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store