The key of the protocol by which an object states its own natural order.
An object whose [compareSymbol] is a method is compared with another such object by calling
a[compareSymbol](b), which returns a negative number, zero or a positive number. Only the sign
is used. The key is Symbol.for('javascript-collections-framework.compare') and does not change
between major versions, so classes keep working across upgrades. Implementations must order
consistently: if a is before b, then b is after a, and the order is transitive.
Time: O(1) to read; the method's cost is the implementer's.
The key of the protocol by which an object states its own natural order.
An object whose
[compareSymbol]is a method is compared with another such object by callinga[compareSymbol](b), which returns a negative number, zero or a positive number. Only the sign is used. The key isSymbol.for('javascript-collections-framework.compare')and does not change between major versions, so classes keep working across upgrades. Implementations must order consistently: ifais beforeb, thenbis aftera, and the order is transitive.Time: O(1) to read; the method's cost is the implementer's.