Skip to content

eq

js
_.eq(value, other)

在两个值之间执行 SameValueZero 比较以确定它们是否相等。

¥Performs a SameValueZero comparison between two values to determine if they are equivalent.

新增于

¥Since

4.0.0

参数

¥Arguments

  1. value (*):要比较的值。

    ¥value ()*: The value to compare.

  2. other (*):要比较的另一个值。

    ¥other ()*: The other value to compare.

返回

¥Returns

(布尔):如果值相等,则返回 true,否则返回 false

¥(boolean): Returns true if the values are equivalent, else false.

示例

¥Example

js
var object = { 'a': 1 };
var other = { 'a': 1 };

_.eq(object, object);
// => true

_.eq(object, other);
// => false

_.eq('a', 'a');
// => true

_.eq('a', Object('a'));
// => false

_.eq(NaN, NaN);
// => true

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