Creating an object array in jQuery
<p>I want to store an array of latitudes/longitudes. I have these inputs on my page:</p>

<pre><code>&lt;input type="hidden" class="latitude" value="-12.3456" /&gt;
&lt;input type="hidden" class="longitude" value="12.3456" /&gt;
&lt;input type="hidden" class="latitude" value="98.7654" /&gt;
&lt;input type="hidden" class="longitude" value="-98.7654" /&gt;
</code></pre>

<p>And I'm putting them into arrays like so:</p>

<pre><code>var latitudes = $('.latitude').map(function () { return this.value; }).get();
var longitudes = $('.longitude').map(function () { return this.value; }).get();
</code></pre>

<p>But I'm thinking that it would be better to store them in a single array as objects, so that I can say:</p>

<pre><code>$.each(array, function (i, obj) {
    alert(obj.Latitude);
    alert(obj.Longitude);
});
</code></pre>

<p>How can I modify this to create an array of objects?</p>
