const { lastName } = objA || objB;
: objA
is truthy, and so it is the result of the OR operator. And it doesn't have a lastName
property, hence the destructured variable lastName
remains undefined
.
const { lastName } = objA || objB;
: objA
is truthy, and so it is the result of the OR operator. And it doesn't have a lastName
property, hence the destructured variable lastName
remains undefined
.