Hey there, I'm currently working on an Angular 11 project and I'm facing a challenge when it comes to checking for null and undefined values.
In my scenario, I have three strings - equipmentId
, roomId
, and personnelId
, as well as a boolean flag called adresseeChosen
.
The objective is to set the adresseeChosen
flag to true if any of the mentioned strings are not null or undefined. Here's the current implementation:
this.adresseeChosen = (this.equipmentId != null && this.equipmentId !== undefined)
|| (this.roomId != null && this.roomId !== undefined)
|| (this.personnelId != null && this.personnelId !== undefined)
Is there a shorter or more concise way to achieve the same result? Appreciate your insights!