Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
The expression reads user.name into a variable named displayName, using "Guest" only when that property value is undefined.
For user = {name: "Ada"}, displayName becomes "Ada"; it does not create a variable named name. For user = {}, displayName becomes "Guest". For user = {name: null}, displayName is null because destructuring defaults do not replace null. This syntax reads the property; it does not rename or modify the property on user.