Primitives compare with SameValueZero, as native Map does: NaN equals NaN, -0 equals
0, null does not equal undefined. Two objects that both implement [equalsSymbol] are
compared by a[equalsSymbol](b); any other objects, and all functions and classes, by identity.
Methods named equals are not used.
Time: O(1) plus the [equalsSymbol] method when one is called.
Parameters
a: unknown
The first value.
b: unknown
The second value.
Returns boolean
true when the values are equal.
Throws
TypeError when [equalsSymbol] returns a value that is not a boolean.
Example
equals(Number.NaN, Number.NaN) // true equals({ x:1 }, { x:1 }) // false: plain objects compare by identity equals(newPoint(1, 2), newPoint(1, 2)) // true when Point implements the protocol
Returns whether two values are equal by value.
Primitives compare with SameValueZero, as native
Mapdoes:NaNequalsNaN,-0equals0,nulldoes not equalundefined. Two objects that both implement[equalsSymbol]are compared bya[equalsSymbol](b); any other objects, and all functions and classes, by identity. Methods namedequalsare not used.Time: O(1) plus the
[equalsSymbol]method when one is called.