Briefle words · Code & architecture
Optional chaining
Also called ?.
A JavaScript operator that reads a property only if the thing before it exists, and otherwise gives back undefined instead of crashing.
Say it to an AI
React TSX ShippingCard for the order page. customer, shippingAddress and delivery are all optional, so handle them explicitly with optional chaining and nullish coalescing and show readable fallbacks like "Guest checkout" and "date TBC" rather than crashing.
How an expert would brief the stronger version of “Order shipping card”.
See it
Try it as a puzzle →Card on an online shop's admin order page. Guest orders have no customer; digital-only orders have no address or delivery.
Why: A writes order.delivery?.estimatedDate and order.customer?.name. B writes order.delivery.estimatedDate, which throws when delivery is missing.
Related words
Room 4 · Errors & edge cases
Learn “Optional chaining” in a five-minute lesson