DEV Community

FADI BAKER
FADI BAKER

Posted on

Combined Comparison Operator

spaceship operator is used to compare two objects. It returns 0 if the first operand equals the second, 1 if the first operand is greater than the second, and -1 if the first operand is less than the second :

Image description

combined comparison operator in .sort descending order:
Image description

Top comments (0)