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

# \_.differenceWith（过滤值）

**语法：**

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

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

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

**描述：**

与difference相比，多了一个`compator`(我这里叫它比较器)。

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

**参数：**

* `array (Array)`: 需要检查的数组。
* `[values] (...Array):` 需要排除的值。
* `[comparator] (Function):` 比较器方法。

**返回值：**

* `array (Array)`: 返回新的块数组。

**例子：**

```javascript
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];

_.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
// => [{ 'x': 2, 'y': 1 }]
```
