We trying to find max value stored in this array. One option is to add (static) max() method to Array below:
This will allow us to call:
Array.max(beersDrunk); // returns 44
Or other way you can define max() on Array's prototype as:
This allows you to call max() method directly on the Array's object itself e.g.:
beersDrunk.max(); // returns 44
Despite all the problems it is interesting method nonetheless. If nothing else, being able to understand how the code above works will make you a better programmer.