Let's say I have the following object:
var obj = {"frutas": 50, "vegetais": 100, "carnes": 150 };
How would I be able to return the key of the highest value item? Example:
obj.maxKey(); // "carnes"
I have tried some functions that treat arrays, but apparently they do not work with objects in the key: value
pattern, for example:
Math.max.apply(null, meuArrayAqui);
So, how could I return the key of the highest value item ?