Why Math.min() > Math.max()?

前端 未结 10 584
暖寄归人
暖寄归人 2020-12-24 12:58

When I type in an array into the parameter of the javascript math minimum and maximum functions, it returns the correct value:

console.log( Math.min( 5 ) );         


        
10条回答
  •  攒了一身酷
    2020-12-24 13:24

    When given no arguments, Math.min() equals infinity and Math.max() is -infinity.

    This is probably to ensure that any value is smaller than the minimum found so far, and larger than the maximum so far.

提交回复
热议问题