I am trying to pull store locations using conditional statements. When I search for Dealer, Wholesale, or retail respectively from select option menu, the results are displayed. However, I cannot display all the location if All is selected. If I remove &&(locationData['category']=== 'Dealer' || 'Wholesale' ||'Retail'), I can show All the locations, but I can't display store locations based on each category. How can I set up a conditional statement?
This is what I have in HTML:
<select id="category" name="category">
<option value="" selected>All</option>
<option value="Dealer">Wholesale &Retail</option>
<option value="Wholesale">Wholesale</option>
<option value="Retail">Retail</option>
</select>
This is what I have in js
if(settings.maxDistance === true && firstRun !== true){
if((locationData['distance'] < maxDistance)&&(locationData['category']=== 'Dealer' || 'Wholesale' ||'Retail')) {
locationset[i] = locationData;
} else {
return;
}
} else {
locationset[i] = locationData;
}
i++;
});
}