# Optional Chaining

*noun*

say it: **“OP-shuh-nul CHAY-ning”** **/ˈɒpʃənəl ˈtʃeɪnɪŋ/** or **“KWES-chun mark DOT”** **/ˈkwɛstʃən mɑːrk dɒt/**

The ?. operator in JavaScript: it reads a property only if the value before it exists, and gives undefined instead of an error when that value is null or undefined.

## What is **Optional Chaining** in JavaScript?

**Optional Chaining** — The ?. operator, which stops and returns undefined when the value before it is nullish.

```javascript
const customer = null;
const city = customer?.address?.city;
```

## In a sentence

- “With **optional chaining**, runner.emergencyContact?.phone gave undefined instead of crashing for runners who left it blank.”

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=2)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/optional-chaining
