구차니 2023. 2. 7. 14:19

배열에서 최소, 최대값 계산하기 함수

 

Math.min.apply(null, arr)
Math.max.apply(null, arr)

[링크 : https://rutgo-letsgo.tistory.com/96]

 

Syntax
apply(thisArg, argsArray)

Parameters
thisArg
The value of this provided for the call to func. If the function is not in strict mode, null and undefined will be replaced with the global object, and primitive values will be converted to objects.

argsArray Optional
An array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function.

[링크 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply]