This section of my code has a problem: postingDate >= selected ||. It works fine when used without another filter, but I don’t understand why it doesn’t work when I use it with another filter and ||
//category filtering
if(selected){
filteredJobs= filteredJobs.filter(({jobLocation, maxPrice, experienceLevel,salaryType,employmentType,postingDate})=>
jobLocation.toLowerCase()=== selected.toLowerCase() ||
parseInt( maxPrice)<= parseInt(selected) ||
postingDate >= selected ||
salaryType.toLowerCase() === selected.toLowerCase() ||
experienceLevel.toLowerCase() === selected.toLowerCase() ||
employmentType.toLowerCase() === selected.toLowerCase()
);
console.log(filteredJobs);
}
works:
if(selected){
filteredJobs= filteredJobs.filter(({jobLocation, maxPrice, experienceLevel,salaryType,employmentType,postingDate})=> postingDate >= selected}
Doesn’t work:
if(selected){
filteredJobs= filteredJobs.filter(({jobLocation, maxPrice, experienceLevel,salaryType,employmentType,postingDate})=>
jobLocation.toLowerCase()=== selected.toLowerCase() ||
parseInt( maxPrice)<= parseInt(selected) ||
postingDate >= selected ||
salaryType.toLowerCase() === selected.toLowerCase() ||
experienceLevel.toLowerCase() === selected.toLowerCase() ||
employmentType.toLowerCase() === selected.toLowerCase()
);
console.log(filteredJobs);
}
New contributor
Leila Kheirandish is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.