Compares two string arrays and returns a comparison result.
The algorithm is as follows:
undefined
0
a
1
b
-1
Comparison function for two values of the same type T.
T
Can be used with Array.prototype.sort and other similar contexts
Array.prototype.sort
First value
Second value
Negative integer if a < b; positive integer if a > b; 0 if equal
a < b
a > b
Compares two string arrays and returns a comparison result.
The algorithm is as follows:
undefined. If both areundefined, return0. Ifaisundefined, return1. Ifbisundefined, return-1.0.