Imagine having this odd code snippet:
var weirdo = {};
var ids = [10, 30, 11, 1, 4, 2];
var producers = ['Ford','Rover','BMW','Fiat','Renault','Mitsubishi'];
var n = producers.length;
for(var i=0; i<n; i++) {
weirdo[ids[i]] = producers[i];
}
// unknown code ???
Is there a way to sort weirdo by its values? Remember, it's not an array and you can't sort the producers array before filling the weirdo object.
Any suggestions on how to tackle this issue?
Also, keep in mind that the relationship between id and producer is VERY IMPORTANT!