Optional chaining (?.) stops evaluation if a property is null or undefined. It returns undefined instead of throwing an error.
const user = { profile: null };
console.log(user.profile?.name); // undefined
// Without ?.: TypeError!
Use ?. when you're unsure if intermediate properties exist. It's safer than assuming.