Closed gumbol closed 3 years ago
Indeed, that's how Math.min
is defined. It would be terribly impractical if it were to return undefined in this case.
yes i think so too. my edited comment i mentioned another option which is to return "same value" or "equal". looking up this further on mdn it turns out the definition of math.min returns a value that is <= to the value its compared to. which is treated as a boundary.
on ch3 exercises dabbling with Math.min/max.
I found that if you add two numbers of the same value the function will return that same value. instead of maybe undefined. unless a number can be larger or smaller than itself. console.log(Math.min(2,2)) // -> 2