compareNatural
compareNatural(x, y)
Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.
Try it yourself:
$1 | compareNatural(2, 3)
| |
$2 | compareNatural(3, 2)
| |
$3 | compareNatural(2, 2)
| |
$4 | compareNatural(5cm, 40mm)
| |
$5 | compareNatural("2", "10")
| |
$6 | compareNatural(2 + 3i, 2 + 4i)
| |
$7 | compareNatural([1, 2, 4], [1, 2, 3])
| |
$8 | compareNatural([1, 5], [1, 2, 3])
| |
$9 | compareNatural([1, 2], [1, 2])
| |
$10 | compareNatural({a: 2}, {a: 4})
|