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

# \_.pullAllWith（删除数组中的元素）

**语法：**

```javascript
_.pullAllWith(array, values, [comparator])
```

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

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

**描述：**

这个方法类似于[`_.pullAll`](https://lodash.com/docs/4.17.10#pullAll)，区别是这个方法接受`comparator`调用`array`中的元素和`values`比较。comparator 会传入两个参数：*(arrVal, othVal)*。

> **注意:**&#x548C;[`_.differenceWith`](https://lodash.com/docs/4.17.10#differenceWith)不同, \_.pullAllWith这个方法会改变数组`array`。

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

**参数：**

* `array (Array)`: 要修改的数组。
* `values (Array)`: 要移除值的数组。
* `[comparator] (Function)`: comparator（比较器）调用每个元素。&#x20;

**返回值：**

* `(Array)`: 返回 array。

**例子：**

```javascript
var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];

_.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
console.log(array);
// => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
```
