Compares the values a and b by their natural order via the < operator. Returns 0 if the values are strictly equal.
a
b
<
0
// ascending[0, 3, 5, 1, 2, 4].sort(naturalOrder) == [0, 1, 2, 3, 4, 5];naturalOrder(-1, 1) === -1;naturalOrder("AA", "B") === -1; // alphabetical for stringsnaturalOrder("A", "a") === -1; // alphabetical for strings
first value
second value
Generated using TypeDoc
Compares the values
a
andb
by their natural order via the<
operator. Returns0
if the values are strictly equal.Example