# Optional Chaining

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

## 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;
```

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/apprentice)

Updated: September 27, 2026

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