title: using an if statement inside a while loop
body: <p>I just figured out how to test for certain conditions and modify output within a loop. But I noticed that testing for two conditionals with the <code>&amp;&amp;</code> operator only works in an <code>if/else if/else if/else</code> chain if it's the first one tested for.</p>
  
  <p>Can someone explain why this works:</p>
  
  <pre><code>var number = 0;
  var counter = 0;
  
  while (counter &lt; 100) {
    number ++;
    counter ++;
    if (number % 3 == 0 &amp;&amp; number % 5 == 0)
      console.log ("FizzBuzz");
    else if (number % 3 == 0)
      console.log("Fizz");
    else if (number % 5 == 0)
      console.log("Buzz");
    else
      console.log(number);
  }
  </code></pre>
  
  <p>But this does not?:</p>
  
  <pre><code>var number = 0;
  var counter = 0;
  
  while (counter &lt; 100) {
    number ++;
    counter ++;
    if (number % 3 == 0)
      console.log("Fizz");
    else if (number % 5 == 0)
      console.log("Buzz");
    else if (number % 3 == 0 &amp;&amp; number % 5 == 0)
      console.log ("FizzBuzz");
    else
      console.log(number);
  }
  </code></pre>