title: Why is this code to calculate a leap year with javascript correct?
body: <p>I wrote this code for calculating a leap year in JavaScript and apparently it's correct but I don't understand why, because it seems logical to me to say: if(year%400===0)....
  but it's incorrect if I do that why??</p>
  
  <p>code:</p>
  
  <pre><code>function isLeap(year) {
      if (year % 4 === 0 &amp;&amp; year % 100 !== 0) {
          if (year % 400) /*this is teh part I am taklking about*/ {
              return "Leap year.";
          }
      } else {
          return "Not leap year.";
      }
  }
  </code></pre>