Why does length come up as undefined?
<pre><code>&lt;div class="aa"&gt;
  &lt;input type='radio' id="1" name='choices' value='1'/&gt;
  &lt;input type='radio' id ="2" name='choices' value='2'/&gt;

  &lt;input type='radio' id="3" name='choices1' value='3'/&gt;
  &lt;input type='radio' id="4" name='choices1' value='4'/&gt;
&lt;/div&gt;
</code></pre>

<p>jQuery</p>

<pre><code>$(".aa :radio").change(function() {

  var names = {};
  $('.aa :radio').each(function() { // find unique names
    names[$(this).attr('name')] = true;
  });
  var count = 0;
  $.each(names, function() { // then count them
    count++;
  });
  alert ("count " + count +  " length " + names.length); //names length comes up as undefined why?
}).change();
</code></pre>
