Skip to content

without

js
_.without(array, [values])

创建一个排除所有给定值的数组,使用 SameValueZero 进行相等性比较。

¥Creates an array excluding all given values using SameValueZero for equality comparisons.

注意:与 _.pull 不同,此方法返回一个新数组。

¥Note: Unlike _.pull, this method returns a new array.

新增于

¥Since

0.1.0

参数

¥Arguments

  1. array (数组):要检查的数组。

    ¥array (Array): The array to inspect.

  2. [values] (...*):要排除的值。

    ¥[values] (...)*: The values to exclude.

返回

¥Returns

(数组):返回新的过滤值数组。

¥(Array): Returns the new array of filtered values.

示例

¥Example

js
_.without([2, 1, 2, 3], 1, 2);
// => [3]

Lodash v4.17 中文网 - 粤ICP备13048890号