javascript-collections-framework
    Preparing search index...

    Variable compareSymbolConst

    compareSymbol: unique symbol = ...

    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.

    class Money implements Comparable<Money> {
    constructor(readonly cents: number) {}
    [compareSymbol](other: Money): number {
    return this.cents - other.cents
    }
    }