Is there an easier way in Typescript/Javascript to check if nested JSON object is null, and then set a value? Right now, we have to peruse through 4 data layers to check if they are null, and then we can conduct operation to set value. Curious if there is any easier syntax?
if (this.addressEntryConfig
&& this.addressEntryConfig.addressModel
&& this.addressEntryConfig.addressModel.partyMailingAddress
&& this.addressEntryConfig.addressModel.partyMailingAddress.address) {
this.addressMailingInputData = this.addressEntryConfig.addressModel.partyMailingAddress.address;
}
Resource: Test for existence of nested JavaScript object key