I have an object in javascript like this:
{ \"a\":4, \"b\":0.5 , \"c\":0.35, \"d\":5 }
Is there a fast way to get the minimum and maximum v
This works for me:
var object = { a: 4, b: 0.5 , c: 0.35, d: 5 };
// Take all value from the object into list
var valueList = $.map(object,function(v){
return v;
});
var max = valueList.reduce(function(a, b) { return Math.max(a, b); });
var min = valueList.reduce(function(a, b) { return Math.min(a, b); });