The type of the elements in the arrays.
The comparator function to use for comparing elements.
A comparator function that can be used for sorting arrays with the Array.prototype.sort method.
[[1,2,3], [1,2,2], [1,1,4]].sort(compareArray((a, b) => a - b));;
//=> [[1,1,4], [1,2,2], [1,2,3]]
[1, [1,2,3], 6, 2, [0,0], [5,6], [1,[2,[3]]]].sort(compareArray((a, b) => a - b)))
//=> [[0,0], [1,[2,[3]]], [1,2,3], [5,6], 1, 2, 6]
Generated using TypeDoc
This sort-comparator function compares two arrays using a provided comparator function. It can compare arrays of any type, as long as the comparator function can handle the type.