Just to make life interesting, you can make the objects in the array sortable (that is, within a containing array) by creating your own custom object:
function Foo(key, value) {
this[key] = value;
}
Foo.prototype.toString = function() {
for (var p in this) {
if (this.hasOwnProperty(p)) {
return this[p];
}
}
}
var a = new Foo('4e95b308d36f429729000021', 1);
var b = new Foo('4e95b309d36f429729000039', 2);
var c = new Foo('4e95b308d36f429729000001', 1);
var popularLocationsArray = [a, b, c];
alert(popularLocationsArray); // 1, 2, 1
alert(popularLocationsArray.sort()); //1, 1, 2
Or you could make it sort on the key name, or combine the key and property, whatever. Just have the toString method return whatever you want them sorted on.