Is there a way to apply this filter while only checking each condition if the value is not undefined
?
For instance, if taxId
is undefined, I would like to skip it rather than using it as a filter criterion.
this.subAgencies = demoSubAgencies.filter(function(subAgency) {
return subAgency.subAgencyName == agencyName
&& subAgency.taxId == taxId
&& subAgency.accountNumber == accountNumber;
});