# \_.max（取数组中最大值）

**语法：**

```javascript
_.max(array)
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L16273)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.max)

**描述：**

计算`array`中的最大值。 如果`array`是 空的或者假值将会返回`undefined`。

**开始版本：**&#x30;.1.0

**参数：**

* `array (Array)`: 要迭代的数组。

**返回值：**

* `(*)`: 返回最大的值。

**例子：**

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lodash.shujuwajue.com/math/max.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
