I agree. Given no arguments, the maximum number should be -Infinity, since that is the max of nothing.
Your example is good, but I would push it even further than 3 to make a case.
Math.max(-100000000) should still return -100000000 as the max, meaning that, no matter how small, or negative, a number is, it should still be allowed the possibility of it being the highest number. Comparing it against -Infinity allows for that.
I agree. Given no arguments, the maximum number should be
-Infinity
, since that is the max of nothing.Your example is good, but I would push it even further than 3 to make a case.
Math.max(-100000000)
should still return -100000000 as the max, meaning that, no matter how small, or negative, a number is, it should still be allowed the possibility of it being the highest number. Comparing it against-Infinity
allows for that.Thanks Nicolas.
That makes total sense with really low negative number as no matter how small a number is, it is bigger than -Infinity