> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/function/negate.md).

# \_.negate

**语法：**

```javascript
_.negate(predicate)
```

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

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

**描述：**

创建一个针对断言函数`func`结果取反的函数。`func`断言函数被调用的时候，`this`绑定到创建的函数，并传入对应参数。

**开始版本：**&#x33;.0.0

**参数：**

* `predicate (Function)`: 需要对结果取反的函数。

**返回值：**

* `(Function)`: 返回一个新的取反函数。

**例子：**

```javascript
function isEven(n) {
  return n % 2 == 0;
}

_.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
// => [1, 3, 5]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/function/negate.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.
