Skip to content

max

js
_.max(array)

计算 array 的最大值。如果 array 为空或为 false,则返回 undefined

¥Computes the maximum value of array. If array is empty or falsey, undefined is returned.

新增于

¥Since

0.1.0

参数

¥Arguments

  1. array (数组):要迭代的数组。

    ¥array (Array): The array to iterate over.

返回

¥Returns

(*):返回最大值。

¥()*: Returns the maximum value.

示例

¥Example

js
_.max([4, 2, 8, 6]);
// => 8

_.max([]);
// => undefined

Lodash v4.17 中文网 - 粤ICP备13048890号