Say I have an array like the following:
var myArray = new Array();
myArray[0] = {ValueA: 10, ValueB:900};
myArray[1] = {ValueA: 50, ValueB:190};
How would I select the element that has the smallest value for ValueA
?
I've used the following to get the max of arrays of numbers before:
var largest = Math.max.apply(Math, myArray);
but i'm not sure how this method could be used to find the max/min of an array of objects. Suggestions?