Optional Chaining in JavaScript

by Jack Pritchard

Hey! Just so you know, this article is over 2 years old. Some of the information in it might be outdated, so take it with a grain of salt. I'm not saying it's not worth a read, but don't take everything in it as gospel. If you're curious about something, it never hurts to double-check with a more up-to-date source!

In this video, I show you how to make use of "Optional Chaining" a new operator available to modern JavaScript applications.

Optional chaining allows us to reference keys if the parent value is defined, as well as reference methods on values when available (e.g. .toUpperCase).

Optional Chaining - CodeSandbox

Optional Chaining by whatjackhasmade using normalize.css, react, react-dom, react-scripts