Skip to content

Glossary: JavaScript Beyond the Basics

?. (optional chaining)

Also written: optional chaining

The `?.` operator reads a property only if the value on its left isn't `null` or `undefined`. Otherwise the whole expression gives `undefined` instead of an error, so `guest.address?.zip` is safe when Lee has no address yet.

Where the book teaches it

Related terms

?? (nullish coalescing)