A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
| Question to ask | Good diagnostic move |
|---|---|
| What value entered? | Inspect the runtime value and type. |
| What rule applied? | Check the construct's language or host semantics. |
| What changed? | Compare the smallest working and failing cases. |
const profile = { settings: null };const theme = profile.settings?.theme ?? 'system';console.log(theme);
This example demonstrates optional chaining and nullish coalescing directly. Change one input at a time and observe the result; the goal is to connect the syntax to the runtime behavior rather than treating the snippet as a recipe.
This example demonstrates optional chaining and nullish coalescing directly. Change one input at a time and observe the result; the goal is to connect the syntax to the runtime behavior rather than treating the snippet as a recipe.
A useful habit here is to inspect the actual value or runtime state rather than trusting a name. The example below is intentionally small, so one changed line has an obvious effect.
Finish the lesson once you have worked through the material. This awards ★ 20 XP.