DEV Community

Discussion on: Math.min returns Infinity?

Collapse
 
gizzzzmo profile image
Gizzzzmo

You can also think of it algebraically, in that all numbers form a monoid under max and min.
The operation is associative, and there exists an identity, namely -infinity for max and infinity for min.
And if you define max/min with arbitrarily many arguments inductively, then the empty operation has to return the identity.