Here is an example to become more specific. All of the answers is same. If i face some challenge which way should i follow ? Actually how they work with their own logic. Want to be clear.
var obj = {
a: "First",
b: {
x: 1,
y: 2
},
c: "last"
}
console.log(obj?.b?.x); // 1
console.log(obj.b.x ?? obj.b); // 1
console.log(obj && obj.b && obj.b.x); // 1
console.log(obj.b ? obj.b.x : undefined); // 1