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,330
  • 9
  • 56
  • 103
Jackson Kasi
  • 99
  • 1
  • 5
  • https://stackoverflow.com/questions/12554578/does-javascript-have-short-circuit-evaluation – akaphenom Nov 02 '21 at 17:58
  • Hi and Welcome to SO. please take the [tour] first. Then read [what kind of questions you can ask here](https://stackoverflow.com/help/on-topic) and [what kind of questions you should not ask here](https://stackoverflow.com/help/dont-ask). Note that SO is not a Forum, Tutorial/Guide nor a free "Code Writing Service". Its for developers that already can code but need community help for specific coding issues such as debugging help. – tacoshy Nov 02 '21 at 18:08
  • 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,309
  • 1
  • 2
  • 6