_.max(array)
_.max(array)
用于返回数组中的最大值。
array
:要查找最大值的数组。
返回值:数组中的最大值。如果数组为空,则返回 undefined。
示例:
javascript
console.log(_.max([4, 2, 8, 6])); // 输出:8
console.log(_.max([-3, -7, -11])); // 输出:-3
console.log(_.max([])); // 输出:undefined
在这个例子中,_.max
返回了数组中的最大值。