Iterating an array collection in Javascript
<p>I'm having trouble with iterating and getting the values within a collection of arrays (an array of arrays I guess)</p>

<p>I'd hope that the code below would display an alert showing the 3 values of each array in turn (eg "infant", "0" and then "2") but the alert just displays "0" "undefined", undefined".</p>

<p>What am I missing?</p>

<p>Declare the array:</p>

<pre><code>var ageGroups = [["infant", 0, 2], ["child", 3, 18], ["child", 3, 17], ["adult1", 18, 64], ["adult2", 65, 74], ["adult3", 75, 79]];
</code></pre>

<p>Iterate the array</p>

<pre><code>for (var item in ageGroups) {
    alert(item[0]);
    alert(item[1]);
    alert(item[2]);
}
</code></pre>
