3 ms·
It might have made more sense to not have default behavior and force the user to specify how they want to sort. They could also have done what PHP did and provi
by xlm1717 11y ago
It might have made more sense to not have default behavior and force the user to specify how they want to sort. They could also have done what PHP did and provided several different .sort functions depending on how you want to sort.
- fenomas 11y agoI think ECMA4 proposed behavior flags, so you could do: arr1.sort( Array.NUMERICAL | Array.DESCENDING ) arr2.sort( Array.CASE_INSENSITIVE ) or similar.