Hesitant will post this as an answer, since I admittedly just take an educated guess, but according to MDN , browser compatibility for Array.sort is listed as ECMAScript5 and βyesβ for everything (as opposed to listing the actual version numbers) - leaving the test to actual support more or less redundant.
The variable name is probably a bit incompatible, because if you really follow what it does, the function that is passed to sort simply returns 0 ; usually you can return 1 or -1 depending on the conditions of comparison to manipulate the order of the array. Thus, the expected result is that the order of the array remains unchanged.
The return statement is just a chain of logical checks on whether the array is in the same order in which it was originally. Perhaps then this supportsSort flag should check if the browser / Javascript sorting function implementation is really a stable algorithm .
source share