title: How to achieve Javascript array index comparison?
body: <p>I have a table that is styled based on cell content. Cell contents are limited to specific data so I created an array. I can style the cell if I reference an index of the array:</p>
  
  <pre><code>var greencell = ["item1", "item2", etc]
  var cells = document.getElementById("mytable").getElementsByTagName("td");
  for (var i = 0; i &lt; cells.length; i++) {
    if (cells[i].innerHTML == greencell[0]) {
      cells[i].style.backgroundColor = "#80ff80";
    }
  }
  </code></pre>
  
  <p>However, I need to access the entire array. When I set comparison <code>==</code> greencell the styling is not applied. What am I missing? Am I even approaching this correctly? Loop through the array similar to the <code>cells</code> loop and set comparison on the loop result? My mind is mush at the moment</p>
  
  <p>Thanks!</p>