> 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/array/xor.md).

# \_.xor（数组取差集）

**语法：**

```javascript
_.xor([arrays])
```

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

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

**描述：**

创建一个给定数组唯一值的数组，使用[symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)做等值比较。返回值的顺序取决于他们数组的出现顺序。

**开始版本：**&#x32;.4.0

**参数：**

* `[arrays] (...Array)`: 要检查的数组。&#x20;

**返回值：**

* `(Array)`: 返回过滤值后的新数组。

**例子：**

```javascript
_.xor([2, 1], [2, 3]);
// => [1, 3]
```


---

# 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/array/xor.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.
