Is the presence of the second optional chaining causing any negative impact?
let flag = somePotentialNullObj?.someNumProp > 0 && somePotentialNullObj?.someOtherProp;
The second optional chaining is unnecessary as it works the same without it:
let flag = somePotentialNullObj?.someNumProp > 0 && somePotentialNullObj.someOtherProp;
If it comes after the &&
, somePotentialNullObj should not be null or undefined, so we shouldn't need to check again with ?
, right?