[javascript] Finding the max value of an attribute in an array of objects