title: Switch Statement not running case as function
body: <p>I'm trying to create a switch statement to filter through all the potential options for a filter on a table but it doesn't recognize the cases when I type anything into the search bar. I can't use an if...else statement for the filter because I need the filters to run together not one instead of the other. I've tried changing the names of the variables to make it more clear that I am designating one var per column but no such luck. Any insight would be greatly appreciated!</p>
  
  <pre><code>var Caps = event.target.value.toUpperCase();
  var Hyphen = event.target.value.replace(/[-]/g, "");
  var rows = document.querySelector("#Catalogue").rows;
  var firstCol = rows[i].cells[0].textContent.replace(/[-]/g, '');
  var thirdCol = rows[i].cells[2].textContent.replace(/[-]/g, '');
  var ColOne =  rows[i].cells[0].textContent.toUpperCase();
  var ColThree = rows[i].cells[2].textContent.toUpperCase();
  
  function filterTable(event) {
  
  for (var i = 1; i &lt; rows.length; i++) 
  {if
  (switch(true){
  
      case (ColThree.indexOf(Caps) &gt; -1 || thirdCol.indexOf(Hyphen) &gt; -1):
          rows[i].style.display = ""
          break;
      case (ColOne.indexOf(Caps) &gt; -1 || firstCol.indexOf(Hyphen) &gt; -1):
          rows[i].style.display = "";
          break;
      case (ColOne.indexOf(Caps) &gt; -1 &amp;&amp; firstCol.indexOf(Hyphen) &gt; -1):
          rows[i].style.display = "";
          break;
      case (ColThree.indexOf(Caps) &gt; -1 &amp;&amp; thirdCol.indexOf(Hyphen) &gt; -1):
          rows[i].style.display = "";
      })
      else{
          rows[i].style.display = "none"
       }
  
     }
  
    }
   document.querySelector('#myInput').addEventListener('keyup', filterTable, 
    false);
  </code></pre>