title: JS Logical operators - OR, AND ('||', '&&') in switch statement
body: <p>The below function is working as expected except case noticed in a comment, namely, for each number:</p>
  
  <ul>
  <li>if the number is divisible by three I want to log out the word <code>fizz</code> instead of that number </li>
  <li>if the number is divisible by five I want to log out the word <code>buzz</code> instead of that number.</li>
  <li>And if a number is divisible by both 3 and 5 I want to log out the word <code>fizzbuzz</code> instead of that number.</li>
  </ul>
  
  <p>Example - 1</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const FizzBuzz = (num) =&gt; {
   for (let i = 1; i &lt;= num; i++) {
    const foo = 0;
    switch (foo) {
     case (i % 3 || i % 5): console.log('fizzbuzz');
     // expect in this case should be work with logical operator '&amp;&amp;': (i % 3 &amp;&amp; i % 5)
      break;
     case i % 3: console.log('fizz');
      break;
     case i % 5: console.log('buzz');
      break;
     default: console.log(i);
    }
   }
  }
  
  FizzBuzz(20)</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is how I know - With switch-case statement preferable use:</p>
  
  <p>Example 2</p>
  
  <pre class="lang-js prettyprint-override"><code>switch(true) {
      case (i % 3 === 0 &amp;&amp; i % 5 === 0): console.log('fizzbuzz');
      break;
      // etc...
  }
  </code></pre>
  
  <p>But with the instance of code above (Example 1: where <code>switch(foo)</code> doesn't have the constant value like <code>true</code>), it looks more flexible and readable.
  And in "Example 1", as I understood, the operator <code>||</code> works like operator <code>&amp;&amp;</code> and vice versa. </p>
  
  <p>The "Example 1" works perfectly as result. But I can't understand Why. Primarily my question is - Why the logical operator <code>OR</code> behave as an operator <code>AND</code> in this example??</p>
  
  <p>Thnx in advance.</p>