I wonder if this can be done in Javascript?
I have a set of conditions, which is a set of filtering criteria for a report
Just say that these are possible filter criteria: (a few pseudo-code, don't worry about the actual JSON structure)
'job' = 'developer'
'job' = 'tester'
'job' = 'manager'
'salary' = 'hourly'
'salary' = 'weekly'
'salary' = 'monthly'
'office' = 'downstairs'
'office' = 'upstairs'
'office' = 'remote'
Now I want to allow the user to filter data, for example Employee which job is either developer or tester who work hourly
In this case I will have javascript like
if ('salary' == 'hourly' && ('job' == 'tester' || 'job' == 'developer')){
return true;
}
but then, if the user wants to add additional parameters to the filter, for example, on top of this, a filter for employees who work remotely, for example office = 'remote'
I would need to write something like
if ('salary' == 'hourly' && ('job' == 'tester' || 'job' == 'developer') && ('office' == 'remote')){ return true; }
, , , , , , , , ?
.