DEV Community

Discussion on: Math.min returns Infinity?

Collapse
 
totiiimon profile image
Totiimon

Despite being a little bit non-intuitive... I think one problem is trying to interprete this function as something like Number.MAX_VALUE In order to compare with something to find the max value, you will always have one number to start on, and to make it to be the max or the lowest always, makes total sense to have the "current" max or min value being -Infinity and Infinity respectively.

Collapse
 
dance2die profile image
Sung M. Kim • Edited

You are spot on with my misthinking that Math.max() === Number.MAX_VALUE 😂