Sort an array with undefined values first
undefined
const array = ["b", undefined, "a"];array.sort(undefinedFirst(stringComparator));console.log(array); // [undefined, "a", "b"]
a Comparator
the Comparator value type
Generated using TypeDoc
Example
Sort an array with
undefinedvalues firstReturns
a Comparator