title: IF Statment Logic Meaning
body: <p>I am working on a project but I was stumped to see this piece of code
  <strong>if ((array.length - 1 - i) % 2 === 1)</strong> I am just curious as to how it works?</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 valid1 = [4, 5, 3, 9, 6, 7, 7, 9, 0, 8, 0, 1, 6, 8, 0, 8];
  
  const validateCred = (array) =&gt; {
    let total = 0;
    for (var i = array.length - 1; i &gt;= 0; i--) {
      // console.log(array[i]) 
      if ((array.length - 1 - i) % 2 === 1) { /*I would like to know what does this do when put in a if statment array.length - 1 - i  */
        array[i] *= 2;
        // console.log(array[i]) 
        if (array[i] &gt; 9) {
          array[i] -= 9;
        }
      }
      total += array[i]
      console.log(total)
    }
    return total % 10 === 0;
  
  };
  console.log(validateCred(valid1))</code></pre>
  </div>
  </div>
  </p>