0
   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?

Amiga500
  • 5,874
  • 10
  • 64
  • 117
Jackson Kasi
  • 119
  • 2
  • 7
  • https://stackoverflow.com/questions/12554578/does-javascript-have-short-circuit-evaluation – akaphenom Nov 02 '21 at 17:58
  • 1
    I’m voting to close this question because code review questions do not fit SO. For code review requests use [Code Review Stack Exchange](https://codereview.stackexchange.com/) instead! – tacoshy Nov 02 '21 at 18:09

1 Answers1

-1

What do you think about:

const hasFilter = [titleValue, sepiValue, discValue, dateValue]
  .find(item => item.toUpperCase().indexOf(filter) > -1);

movieCard[i].style.display = hasFilter ? "" : "none";
munleashed
  • 1,677
  • 1
  • 3
  • 9