Do you know what will be the output of this code?
JavaScript
const user = {};
console.log(user.profile?.name.first);
Show answer and explanation
The answer is undefined.
user.profile is undefined, so ?. stops the whole expression right there. .name.first is never evaluated, so there’s no error.