Why array.push() is used to make an object?
<p>I was reading <a href="http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript">Get query string values in JavaScript</a> on Stackoverflow and this piece of code from the first reply made me wonder why ´vars.push()´ is used like this?</p>

<pre><code>function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&amp;');
    for(var i = 0; i &lt; hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}
</code></pre>

<p>But instead of this:</p>

<pre><code>var vars=[];
...
vars.push(hash[0]);
vars[hash[0]] = hash[1];
</code></pre>

<p>I rewrote the code like:</p>

<pre><code>var vars={};
...
vars[hash[0]] = hash[1];
</code></pre>

<p>and it works. Now the questions are:</p>

<ul>
<li>why would someone use an array for that kind of reply?</li>
<li>and why would someone use <code>ARR.push(KEY)</code> and then use <code>ARR[KEY]=VAL</code> format afterwards?</li>
</ul>
