What does this optional chaining expression return?

Consider this snippet.

const user = {};
console.log(user.profile?.name ?? 'guest');

What does this print and why.

Sora

It prints 'guest', because user.profile is undefined, so user.profile?.name short-circuits to undefined and ?? only falls back on null or undefined-not other falsy values like ''.

MechaPrime