title: Javascript foreach loop on list items
body: <p>I have a basic HTML list like below...</p>
  
  <pre><code>&lt;ul class="test_ul"&gt;
      &lt;li class="item" id="item1"&gt;
          Item 1
      &lt;/li&gt;
      &lt;li class="item" id="item2"&gt;
          Item 2
      &lt;/li&gt;
      &lt;li class="item" id="item3"&gt;
          Item 3
      &lt;/li&gt;
      &lt;li class="item" id="item4"&gt;
          Item 4
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I am using javascript to try and grab the id of each list item and then use a loop to check each one against a string.  I have this so far..</p>
  
  <pre><code>var myvariable
  myvariable = "item2"
  items = document.getElementsByClassName("item");
  for (i = 0; i &lt; items.length; i++) {
      console.log(i);
      console.log(item[i]);
  }
  </code></pre>
  
  <p>This isn't working for me, is it because it is not really an array?</p>