Charlie Harvey


About max and min: I'd have hoped that Math.max() and Math.min() would cause an error, but that's just me.

One way to look at it, though, is that surely any max function would have the property that for two arrays a and b, Math.max(a.concat(b)) == Math.max(Math.max(a), Math.max(b)), right? Now, suppose b is the empty array. Then a.concat(b) is just a, so Math.max(a) == Math.max(Math.max(a), Math.max([])) but for that to be true, it must be true that no matter what a is, Math.max(a) >= Math.max([]) and the only way that can be true is if Math.max([]) == -Infinity and analogously for min, Math.min([]) == +Infinity