Optional Chaining ?. Playground

Bayu walks nasabah?.alamat.kota drawer by drawer: what happens when a plain dot meets null, and what does ?. guard at each place it is written? An interactive…

Why it matters

API data often has fields that are sometimes there, sometimes null. Without ?., one empty field means a blank screen. ?. (with ?? for defaults) makes data access sturdy without long && chains.

The key idea

?. stops at null or undefined, and the rest never runs

Common mistakes

Try it in this playground