title: javascript loop through list items and return the results in an array
body: <p>I have been trying to loop through an unordered list of numbers with javascript. The function should store all of the numbers in an array so I can find which numbers are duplicates. Any help would be appreciated. So far I have:</p>
  
  <pre><code>    &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;ul id="ul"&gt;
      &lt;li&gt;6&lt;/li&gt;
      &lt;li&gt;3&lt;/li&gt;
      &lt;li&gt;1&lt;/li&gt;
      &lt;li&gt;4&lt;/li&gt;
      &lt;li&gt;7&lt;/li&gt;
      &lt;li&gt;4&lt;/li&gt;
      &lt;li&gt;2&lt;/li&gt;
      &lt;li&gt;8&lt;/li&gt;
      &lt;li&gt;9&lt;/li&gt;
      &lt;li&gt;2&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and a start on the javascript:</p>
  
  <pre><code>(function(){
  
              var nums = document.getElementById("ul");
              var listItem = nums.getElementsByTagName("li");
  
              var newNums = "";
  
              var dups = function(){
              for (var i = 0; i &lt; listItem.length; i++){
  
              }
  
              }; dups();
  
              })();
  </code></pre>
  
  <p>what am I missing?</p>