Optional chaining is definitely a great solution for the same problem!

But the solution I described here is not misguided, just another solution to a problem.

The thing with optional chaining is, not all major browsers do support it. Of course, we have Babel and Typescript that do support it šŸ˜‰

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