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

# \_.intersectionBy（数组交集）

**语法：**

```javascript
_.intersectionBy([arrays], [iteratee=_.identity])
```

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

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

**描述：**

这个方法类似[`_.intersection`](https://lodash.com/docs/4.17.10#intersection)，区别是它接受一个`iteratee`调用每一个`arrays`的每个值以产生一个值，通过产生的值进行了比较。结果值是从第一数组中选择。iteratee 会传入一个参数：*(value)*。

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

**参数：**

* `[arrays](...Array)`:待检查的数组。
* `[iteratee=_.identity] (Function)::` iteratee（迭代器）调用每个元素。

**返回值：**

* `(Array):` 返回一个包含所有传入数组交集元素的新数组。

**例子：**

```javascript
_.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
// => [2.1]

// The `_.property` iteratee shorthand.
_.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }]
```
