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:
<html>
<head>
<title></title>
</head>
<body>
<ul id="ul">
<li>6</li>
<li>3</li>
<li>1</li>
<li>4</li>
<li>7</li>
<li>4</li>
<li>2</li>
<li>8</li>
<li>9</li>
<li>2</li>
</ul>
</body>
</html>
and a start on the javascript:
(function(){
var nums = document.getElementById("ul");
var listItem = nums.getElementsByTagName("li");
var newNums = "";
var dups = function(){
for (var i = 0; i < listItem.length; i++){
}
}; dups();
})();
what am I missing?