Understanding this Javascript code using % modulus
<p>Im currently in process of learning Javascript. And I have seen the following code, which confuses me.</p>

<p><strong>Description of code:</strong><br>
Starting on line 1, the function isOdd takes a number n and returns a boolean (true or false) stating whether the number is odd or not.</p>

<p><strong>Code</strong> <br></p>

<pre><code>var isOdd = function (n) {
      if (n % 2 === 0) {
        return false;
      } else {
        return true;
      }
    };

    var isEven = function(n) {
        if(n % 2 === 0) {
            return true;
        } else {
            return false;
        }
    };
</code></pre>

<p><strong>Where I am confused.</strong><br>
The code:</p>

<pre><code>n % 2 === 0
</code></pre>

<p>I have always taken the following to be the description for %:</p>

<pre><code>% Is the modulus operator. It returns the remainder of dividing number1 by number2.
</code></pre>

<p>Which would mean that the if statement in the function isOdd returns false is the difference between n and 2 is 0. But its meant to mean if n is divisible by 2 (even) return false. </p>

<p>I just dont see how its doing that. </p>

<p>In my mind, if we take the even number 30. Apply it to n % 2. We get 15, which is remainder of dividing 30 by 2. 15 does not equal 0, but 30 is an even number, and with this code it would be seen as odd.</p>

<p>Can someone explain this?</p>
