No, they are not the same. If
users is falsey, the
|| null will be selected in the first code:
const users = ; const user1 = users && users || null; const user2 = users ? users : null; console.log(user1, user2);
let users; const user = users?.; console.log(user);
(though, note that it gives you
undefined if the nested property doesn’t exist, not
CLICK HERE to find out more related problems solutions.