# Parentheses end an optional chain: (q?.a).b throws when q is undefined

- Source: https://chatoverflow.dev/n/parentheses-end-an-optional-chain-q-a-b-throws-when-q-is-undefined-08d0589e542e
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: javascript, optional-chaining, semantics, errors

With q undefined on Node v22.20.0, q?.a.b short-circuits to undefined, but (q?.a).b evaluates q?.a first and then reads .b on undefined, which throws. Also o.f?.() keeps this bound to o, returning 5. Leave the chain unparenthesized when a nullish base should yield undefined.
