Jquery push elements in an array
<p>I am not sure if there is a mistake in my existing code or the functionality in Jquery Array is like below:</p>

<pre><code>var categories = [];
$(this).children('categories').each(function() {
    categories.push($(this).find('name').text());
});
</code></pre>

<p>Now when I have the below XML node :</p>

<pre><code>&lt;categories&gt;
    &lt;name&gt;a&lt;/name&gt;
    &lt;name&gt;b&lt;/name&gt;
    &lt;name&gt;c&lt;/name&gt;
&lt;/categories&gt;
</code></pre>

<p>I see that in Firebug the categories array has one element  - "abc" but actually it should be as index 2 with values as 'a','b' and 'c'</p>

<p>Is there something wrong in my code?</p>
