title: Stripe table JavaScript
body: <p>I am trying to make a table which will display colours for odd and even table rows, not sure where I'm going wrong</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;table id="tableStyles" border="1"&gt;
    &lt;th&gt;Heading 1&lt;/th&gt;
    &lt;th&gt;Heading 2&lt;/th&gt;
    &lt;th&gt;Heading 3&lt;/th&gt;
    &lt;tr&gt;
      &lt;td&gt;Odd&lt;/td&gt;
      &lt;td&gt;Odd&lt;/td&gt;
      &lt;td&gt;Odd&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Even&lt;/td&gt;
      &lt;td&gt;Even&lt;/td&gt;
      &lt;td&gt;Even&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Odd&lt;/td&gt;
      &lt;td&gt;Odd&lt;/td&gt;
      &lt;td&gt;Odd&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Odd&lt;/td&gt;
      &lt;td&gt;Odd&lt;/td&gt;
      &lt;td&gt;Odd&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>var isEven = function(someNumber) {
    return (someNumber%2 == 0) ? true : false;
  };
  if isEven = true {
    var styletab = document.getElementsByTagName("tableStyles");
    var cells = table.getElementsByTagName("td"); 
    for (var i = 0; i &lt; styletab.length; i++) {
      styletab[i].style.fontSize = "12px";
      styletab[i].style.color = "blue";
    }
  
  } else {
    var styletab = document.getElementsByTagName("tableStyles");
  var cells = table.getElementsByTagName("td"); 
  for (var i = 0; i &lt; styletab.length; i++) {
    styletab[i].style.fontSize = "12px";
    styletab[i].style.color = "red";
    }
  }
  </code></pre>