I'm working on an Angular 11 project and I'm struggling with checking for null and undefined.
I have three strings - equipmentId
, roomId
and personnelId
and a flag (boolean) adresseeChosen
.
I want the adresseeChosen
to be true if at least one of the above strings is not null / undefined, this is my code
this.adresseeChosen= (this.equipmentId != null && this.equipmentId != undefined)
|| (this.roomId != null && this.roomId != undefined)
|| (this.personnelId != null && this.personnelId != undefined)
What's the short way of writing this? Thanks!