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

**语法：**

```javascript
_.remove(array, [predicate=_.identity])
```

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

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

**描述：**

**Note:**&#x548C;[`_.filter`](https://lodash.com/docs/4.17.10#filter)不同, \_.remove这个方法会改变数组`array`。使用[`_.pull`](https://lodash.com/docs/4.17.10#pull)来根据提供的`value`值从数组中移除元素。

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

**参数：**

* `array (Array)`: 要修改的数组。
* `[predicate=_.identity] (Array|Function|Object|string)`: 每次迭代调用的函数。

**返回值：**

* `(Array)`: 返回移除元素组成的新数组。

**例子：**

```javascript
var array = [1, 2, 3, 4];
var evens = _.remove(array, function(n) {
  return n % 2 == 0;
});

console.log(array);
// => [1, 3]

console.log(evens);
// => [2, 4]
```


---

# Agent Instructions: 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/remove.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.
