if (
titleValue.toUpperCase().indexOf(filter) > -1 ||
sepiValue.toUpperCase().indexOf(filter) > -1 ||
discValue.toUpperCase().indexOf(filter) > -1 ||
dateValue.toUpperCase().indexOf(filter) > -1
) {
movieCard[i].style.display = "";
} else {
movieCard[i].style.display = "none";
}
** I want to short this code at code statement ||
**
I want to use dry consent in this code, please anyone help?
CodePudding user response:
What do you think about:
const hasFilter = [titleValue, sepiValue, discValue, dateValue]
.find(item => item.toUpperCase().indexOf(filter) > -1);
movieCard[i].style.display = hasFilter ? "" : "none";